Saving Image/Picture to Database using ADO
- From: "Leonard Mann" <leonard@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 19 Oct 2006 19:23:07 -0600
Can someone help with loading a JPG image into an SQL database using Delphi
7.
All the links I find don't quite do it for me.
The problem is simple.
Load a JPG file stored on my Hard Drive into an MSSQL database field.
I have tried the following but I get a 'Bitmap Image is Invalid' Error
message.
procedure TfrmCompany.SaveJpegToTable(Table: TADOQuery; PicField:TBlobField;
sPicPath: string);
{
Usage:
SPicFileName := 'C:\!gajba\cdcovers\cdcover1.jpg';
SaveJpegToTable(ADOTable1, ADOTable1Picture, SPicFileName);
}
var
fS : TFileStream;
begin
// fs:=TFileStream.Create(sPicPath, fmOpenRead);
fs:=TFileStream.Create(PicField, fmOpenRead);
try
Table.Edit;
// JpegStartsInfs(PicField, fs);
PicField.LoadFromStream(fs);
Table.Post;
finally
fs.Free;
end;
end;
Any help would be appreciated.
Thanks,
Leonard
.
- Follow-Ups:
- Re: Saving Image/Picture to Database using ADO
- From: Brian Bushay TeamB
- Re: Saving Image/Picture to Database using ADO
- Prev by Date: Re: Strange "unspecified error" in D7/Access query
- Next by Date: Re: Saving Image/Picture to Database using ADO
- Previous by thread: Strange "unspecified error" in D7/Access query
- Next by thread: Re: Saving Image/Picture to Database using ADO
- Index(es):