zeoslib+delphi2010 read a database create on delphi2007 err

Forum related to SQLite

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
wwywt
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 17.12.2010, 11:11

zeoslib+delphi2010 read a database create on delphi2007 err

Post by wwywt »

first sorry for my english I'M A Chinese
i have a database created on delphi2007 with zeoslib
i saved an icon file in then 'Icon' field(blob).
when i try to read then icon field with delphi2010+zeoslib 7.0
i got a error.
this is my code:

procedure TForm1.ReadClick(Sender: TObject);
begin
ZConnection := TZConnection.Create(nil);
try
ZConnection.Protocol := 'sqlite-3';
ZConnection.Database := ExtractFilePath(Application.ExeName) + 'STData.dat';
ZConnection.Connect;
if not ZConnection.Connected then Exit;
ZTable := TZTable.Create(nil);
try
ZTable.TableName:='Game';
ZTable.Connection:=ZConnection;
ZTable.Active:=True;
ZTable.First;
TBlobField(ZTable.FieldByName('Icon')).SaveToFile('c:\test.ico');
//my problem :
//in delphi 2007 the file test.ico is correct
//but in delphi2010 the file is a wrong file
finally
FreeAndNil(ztable);
end;
finally
FreeAndNil(ZConnection);
end;
end;
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Problem you have is that the image encoding is changed for sqlite since zeoslib 7. Have a look at this discussion (only the blob part for you) : http://zeos.firmos.at/viewtopic.php?t=3011

Mark
Image
Post Reply