Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP: Saving a .JPG to Database using Interbase. What I'm doing wrong?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm trying to save an photo.jpg image to a database, but
something is wrong. Compiler say that dataset is read-only.
HELP! HELP!
Here some code:

var BS: TBlobStream;
Imagem: TJPegImage;
begin
ibquery1.edit;
BS := TBlobStream.Create(ibquery1.FieldByName('IMAGEX') AS TBlobField, BMWRITE);
Imagem:=TJPegImage.Create;
Imagem.LoadFromFile('photo.jpg');
Imagem.SaveToStream(BS);
dbimage1.Picture.Assign(Imagem);
BS.Free;
Imagem.Free;
ibquery1.Post;
end;
 
TIBQuery components are indeed readonly.
You need to use an TIBSQL or TIBUpdateSQL component (the latter you can connect to the TIBQuery which may be all you need to do if you get the SQL in it correct).

My problem is the reverse. I can write a JPG easily but can't display it again afterwards :(
 
OK, seems I cheered too soon. Got no error but nothing is being written...

Must delve deeper into this. Had some code that worked in D5 but for some reason doesn't seem to work in D7 (or I did something wrong adapting it).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top