RAD Studio VCL Reference
|
Creates an instance of TBlobStream.
constructor Create(Field: TBlobField; Mode: TBlobStreamMode);
__fastcall TBlobStream(TBlobField Field, TBlobStreamMode Mode);
Call Create to obtain an instance of TBlobStream for reading from or writing to a specific TBlobField object.
Value |
Meaning |
bmRead |
The BLOB stream can read data from the field. |
bmWrite |
The BLOB stream can replace the data in the field. |
bmReadWrite |
The BLOB stream can modify the data in the field. |
C++ Examples:
/* The following example copies the data in the Notes field of Table1 or SQLDataSet1 to the Remarks field of ClientDataSet1. */ void __fastcall TForm1::Button1Click(TObject *Sender) { TBlobType blobType = Table1Notes->BlobType; TStream *Stream1 = new TBlobStream(Table1Notes, bmRead); try { CDS2->Edit(); // here’s a different way to create a blob stream } TStream *Stream2 = CDS2->CreateBlobStream(CDS2->FieldByName("Remarks"), bmReadWrite); try { Stream2->CopyFrom(Stream1, Stream1->Size); // CDS2.Post; // CDS2.Active := True; } __finally { delete Stream2; } } __finally { delete Stream1; } };
Delphi Examples:
{ The following example copies the data in the Notes field of Table1 or SQLDataSet1 to the Remarks field of ClientDataSet1. } procedure TForm1.Button1Click(Sender: TObject); var Stream1: TBlobStream; Stream2: TStream; blobType : TBlobType; begin blobType := Table1Notes.BlobType; Stream1 := TBlobStream.Create(Table1Notes, bmRead); try CDS2.Edit; { here’s a different way to create a blob stream } Stream2 := CDS2.CreateBlobStream(CDS2.FieldByName('Remarks'), bmReadWrite); try Stream2.CopyFrom(Stream1, Stream1.Size); // CDS2.Post; // CDS2.Active := True; finally Stream2.Free; end; finally Stream1.Free; end; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|