Use LoadFromStream to copy the contents of a stream into the BLOB field. Specify the stream from which the field抯 value is copied as the value of the Stream parameter.
Note: The Stream parameter is typically not a BLOB stream. BLOB streams (returned by the dataset抯 CreateBlobStream method) provide a completely separate mechanism for streaming data into a BLOB field.
var
MS: TMemoryStream;
begin
if not (ClientDataSet1.State in [dsInsert, dsEdit]) then
ClientDataSet1.Insert;
MS := TMemoryStream.Create();
try
Image1.Picture.Bitmap.SaveToStream(MS);
ClientDataSet1Images.LoadFromStream(MS);
finally
MS.Free;
end;
ClientDataSet1.Post;
end;
if ((ClientDataSet1->State != dsInsert) &&
(ClientDataSet1->State != dsEdit))
ClientDataSet1->Insert();
TMemoryStream *pMS = new TMemoryStream;
try
{
Image1->Picture->Bitmap->SaveToStream(pMS);
ClientDataSet1Images->LoadFromStream(pMS);
}
__finally
{
delete pMS;
}
ClientDataSet1->Post();