hi,man: i have received following message for this kind of question, he has used TFileStream to load any picture.这可以处理多种格式的图象文件 procedure TFrmblobexample.Button1Click(Sender: TObject); begin if(opendialog1.execute)then begin sfilename:=opendialog1.filename; adoquery1.Append; adoquery1.FieldByName('name').asstring:=sfilename; adoquery1.fieldbyname('blobs').asstring:=blobcontenttostring(sfilename); adoquery1.post; end; end; function TFrmblobexample.blobcontenttostring( const filename: string): string; begin with tfilestream.create(filename,fmopenwrite)do try setlength(result,size); read(pointer(result)^,size); finally free; end; end;My question: when i save image to SQL SERVER image field, My Delphi BDE always returns "BDEDatabaseerror for INVALID BLOB SIZE",i do not know whether it is the mistake of my Delphi 5.5 or the Mistake of SQL SERVER.
i have received following message for this kind of question, he has used TFileStream to load any picture.这可以处理多种格式的图象文件
procedure TFrmblobexample.Button1Click(Sender: TObject);
begin
if(opendialog1.execute)then
begin
sfilename:=opendialog1.filename;
adoquery1.Append;
adoquery1.FieldByName('name').asstring:=sfilename;
adoquery1.fieldbyname('blobs').asstring:=blobcontenttostring(sfilename);
adoquery1.post;
end;
end; function TFrmblobexample.blobcontenttostring(
const filename: string): string;
begin
with tfilestream.create(filename,fmopenwrite)do
try
setlength(result,size);
read(pointer(result)^,size);
finally
free;
end;
end;My question:
when i save image to SQL SERVER image field, My Delphi BDE always returns "BDEDatabaseerror for INVALID BLOB SIZE",i do not know whether it is the mistake of my Delphi 5.5 or the Mistake of SQL SERVER.