Page 1 of 1

LoadFromFile ZOES + PostGreSQL + field Bytea

Posted: 12.05.2009, 15:48
by scribes
Hi All,

I'm trying to upload a file to a field of type byte to PostGeSQL and I received the error below when I post a query

I'm using the code below

Stream := TMemoryStream.Create();
Stream.LoadFromFile(DAbre.FileName);
ZImagem.edit;
TBlobField(ZImagem.FieldByName('programa')).LoadFromStream(Stream);
ZImagem.post;
Stream.Free;

Thanks
Edmilson

Posted: 12.05.2009, 19:33
by trupka

Code: Select all

(ZImagem.FieldByName('programa') as TBlobField).LoadFromFile(fileName)
Maybe this should do it?

Posted: 12.05.2009, 22:26
by scribes
Hi,

The same mistake not resolved

Thanks

Edmilson

Posted: 12.05.2009, 22:33
by seawolf
Which Delphi version are you using?

Does exists a column with the name displayed on the MessageDlg?

Posted: 13.05.2009, 03:50
by scribes
Hi,
I use Turbo Delphi
Not content that he is claiming and the contents of the file.

Thanks

Edmilson

Posted: 13.05.2009, 10:12
by trupka
scribes,
I'm having trouble to read text on attached picture, but it seems that error is more "database related".
Maybe you can use TZSQLMonitor or look into postgresql log file to reveal some more details about error?

Posted: 15.05.2009, 07:07
by scribes
Hi, trupka
Thanks for the idea I saw the error with TZSQLMonitor, I just generate the insert with the table name field and the error was here
app.name_app the right and so the field name_app

Thanks All

Edmilson