![]() |
save image from database with TblobField
hi, i have the following query to save image from database, if i save an image which is 300 kb but when i want to save the same image from the database, it always save with a fixed size 33 kb
Code:
dont have any idea why its save with fixed 33 kb, do you have any suggestion?
Query.SQL.Clear;
Query.SQL.Add('select Image from TablePic where id =1'); Query.Open; BlobField := Query.FieldByName('Image ') As TBlobField; BlobField.SaveToFile(FileName); |
AW: save image from database with TblobField
Just a random guess: Does
Delphi-Quellcode:
yield the same result?
TBlobField.SaveToStream(..)
Also, what are you saving the image with? Can you successfully retrieve the full amount of 300KB with another application? |
AW: save image from database with TblobField
Delphi-Quellcode:
Are you sure that you're checking the right file?
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); You should also check if the name "Image" is treated as a ![]() Probably it isn't a reserved word but if it is you will get weird results. |
AW: save image from database with TblobField
I have checked the query whether is empty or not but the query is not empty
i have also change the name Image to Bild but still it saves the size of 33 kb |
AW: save image from database with TblobField
There's a space in your FieldByName. Maybe this causes Problems?
By the way: If you're german (because of your "Bild") then you may just speak german, because this is a german forum :mrgreen: |
AW: save image from database with TblobField
Which database and which data access components?
|
AW: save image from database with TblobField
it is Tquery component with mysql database and delphi 2010
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:31 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz