Saving blob into MSSQL using dbexpress in Delphi
Posted: Tue 06 Dec 2005 11:26
I not able to save blob variable into MSSQL server using dbexpress with corelab dlls in Delphi. Using this code. There is no problem or error during saving, but at the end the blob field is empty. I've tried diferent ways to seve it, but nothing works.
Any idea?
thnx 4 help
Any idea?
thnx 4 help
Code: Select all
procedure TFoNew.ulozblob(id:string);
var
Lstream: TStream;
begin
OpenDialog1.Title := 'Načíst smlouvu...';
if OpenDialog1.Execute then
begin
OCAttachment.CreateObjectFromFile(opendialog1.FileName, False);
dmmain.SQLCD101.Locate('id',id,[]);
try
dmmain.SQLCD101.Edit;
try
LStream := dmmain.SQLCD101.CreateBlobStream(dmmain.SQLCD101.FieldByName('priloha'),bmReadWrite);
OCAttachment.SaveToStream(LStream);
dmmain.SQLCD101.Post;
except
end;
finally
OCAttachment.DestroyObject;
Stream2.Free;
end;
end;
end;