aStream:TMemoryStream;
aStream:=TMemoryStream.Create;
字段保存到stream
qrypub.ParamByName('Data').LoadFromStream(aStream, ftBlob);
从字段读取到Stream里
TBlobField(dm.qrypub.FieldByName('FILE_TEXT')).SaveToStream(aStream);
aStream.position:=0;
用完后释放
aStream.Free;
TBlobField *BlobField=(TBlobField *) DataMod->InsertTable->FieldByName("ff");
//文件到字段
TBlobField *blob_pic=(TBlobField *)UserMod->TInsert->FieldByName("IMAGE");
blob_pic->LoadFromFile(app_path+"//temp//temp.jpg");
//字段到文件
TBlobField *blob_pic=(TBlobField *)DBGrid4->DataSource->DataSet->FieldByName("IMAGE");
try
{
blob_pic->SaveToFile(app_path+"//temp//temp1.jpg");
Image9->Picture->LoadFromFile(app_path+"//temp//temp1.jpg");
TMemoryStream * aStream = new TMemoryStream;
((TBlobField*) ADOQuery4->FieldByName("ff"))->SaveToStream(aStream);
aStream->SaveToFile(SaveDialog1->FileName );