Re: Saving Image/Picture to Database using ADO
- From: "Leonard Mann" <leonard@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 20 Oct 2006 08:04:39 -0600
I tried both of theses options and still get the same 'Bitmap Image is
Invalid' Error message.
qryCompanyLOGO.LoadFromFile(SPicFileName);
(qryCompany.fieldbyName('LOGO') as TblobField).loadFromfile(SPicFileName);
The jpeg is valid because it will load into my DBImage with the following
code:
Pic:=TJpegImage.Create;
try
Pic.LoadFromFile(FileName);
finally
DBImage1.Picture.Assign(Pic);
end
The database field in the MSSQL Database is of type 'image'.
I am using a TADOQuery as my datasource.
Is there any reason why either of the top two options would not work?
"Brian Bushay TeamB" <BBushay@xxxxxxxxx> wrote in message
news:dbfgj21j1jsjnimped0n1vql65bp3re2d0@xxxxxxxxxx
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
Table.Edit;
( Table.fieldbyName('picfield') as
TblobField).loadFromfile(SPicFileName);
Table.Post;
--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.
- Follow-Ups:
- Re: Saving Image/Picture to Database using ADO
- From: Brian Bushay TeamB
- Re: Saving Image/Picture to Database using ADO
- From: Dennis Passmore
- Re: Saving Image/Picture to Database using ADO
- References:
- Saving Image/Picture to Database using ADO
- From: Leonard Mann
- Re: Saving Image/Picture to Database using ADO
- From: Brian Bushay TeamB
- Saving Image/Picture to Database using ADO
- Prev by Date: Re: edit and/or insert records in TADODataset
- Next by Date: Is this correct? (TADOConnection)
- Previous by thread: Re: Saving Image/Picture to Database using ADO
- Next by thread: Re: Saving Image/Picture to Database using ADO
- Index(es):