I have a DataSource connected to a ClientDataSet. The database file is stored local on my computer in a binary MyBase file.
The ClientDataSet has 1 Blob field and i want to store images in this field. When changing the image, the database increases its size instead of deleting the old content completly. Can someone give me an example what to do to remove the old content in a Blob field completly instead of increasing the size in my database?
Here is a small example for testing. Every time I press the button, the DB file increases its size. No new Record is created.
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientDataSet1.Edit;
TBlobField(ClientDataSet1.FieldByName('blob')).Clear;
TBlobField(ClientDataSet1.FieldByName('blob')).LoadFromFile('C:\Users\xxx\Desktop\example.bmp');
ClientDataSet1.Post;
ClientDataSet1.SaveToFile(ExtractFilePath(ParamStr(0)) + 'DB.cds', dfBinary);
end;
When I run if TBlobField(ClientDataSet1.FieldByName('blob')).IsNull
directly after the clear command, it says that its empty.