直接用TADOBlobStream而不用TMemoryStream 可不可以
void __fastcall TForm1::btn3Click(TObject *Sender)//读取文件
{
if(!dlgSave1->Execute())
return;
qry1->SQL->Text = "select * from mytable1 where id =1";
qry1->Open();
TBlobField * pField1=(TBlobField *)qry1->FieldByName("content");
if(!pField1->IsNull)
{
TADOBlobStream* pmem=new TADOBlobStream (pField1,bmRead);
pmem->Seek(0,soFromBeginning);
//TMemoryStream *Inifile = new TMemoryStream();
//Inifile->LoadFromStream(pmem);
//Inifile->SaveToFile(dlgSave1->FileName);
pmem->SaveToFile(dlgSave1->FileName); //直接用这个TADOBlobStream对象指针
//delete Inifile;
delete pmem;
}
qry1->Close();
}
void __fastcall TForm1::btn3Click(TObject *Sender)//读取文件
{
if(!dlgSave1->Execute())
return;
qry1->SQL->Text = "select * from mytable1 where id =1";
qry1->Open();
TBlobField * pField1=(TBlobField *)qry1->FieldByName("content");
if(pField1->BlobSize > 0)
pField1->SaveToFile(dlgSave1->FileName); //直接用这个TBlobField 对象指针
qry1->Close();
}