CreateBlobStream (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example copies the data in the Notes field of Table1 or SQLDataSet1 to the Remarks field of ClientDataSet1.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TBlobType blobType = Table1Notes->BlobType;
  TStream *Stream1 = new TBlobStream(Table1Notes, bmRead);
  try
  {
	CDS2->Edit();
	// Here is 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;
  }
};

Uses

Personal tools
Assistance