Data.DB.TBlobField.LoadFromStream
[–] Properties | |
---|---|
Type: procedure function
| |
Visibility: public | |
Source: Data.DB.pas Data.DB.hpp
| |
Unit: Data.DB | |
Parent: TBlobField |
Delphi
procedure LoadFromStream(Stream: TStream);
C++
void __fastcall LoadFromStream(System::Classes::TStream* Stream);
Description
Loads BLOB data from a stream into the field.
Use LoadFromStream to copy the contents of a stream into the BLOB field. Specify the stream from which the value of the field is copied as the value of the Stream parameter.
Note: The Stream parameter is typically not a BLOB stream. BLOB streams (returned by the CreateBlobStream method of the dataset) 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();