Page 1 of 1

zeoslib+delphi2010 read a database create on delphi2007 err

Posted: 17.12.2010, 11:51
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;

Posted: 17.12.2010, 20:58
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