Einzelnen Beitrag anzeigen

Benutzerbild von sx2008
sx2008

Registriert seit: 15. Feb 2008
Ort: Baden-Württemberg
2.332 Beiträge
 
Delphi 2007 Professional
 
#3

AW: save image from database with TblobField

  Alt 29. Aug 2013, 16:14
Delphi-Quellcode:
Query.SQL.Text := 'select Image from TablePic where id =1';
Query.Open;
if Query.IsEmpty then // you should test this
  raise Exception.Create('image not found in database');
BlobField := Query.FieldByName('Image ') As TBlobField;
//...................................^ why is there a blank?
BlobField.SaveToFile(FileName);
Are you sure that you're checking the right file?
You should also check if the name "Image" is treated as a reserved word by your DBMS.
Probably it isn't a reserved word but if it is you will get weird results.
fork me on Github
  Mit Zitat antworten Zitat