On 18/07/06, Joost van der Sluis <[EMAIL PROTECTED]> wrote:

> Hmm. i think i found something : TSQLQuery's ApplyUpdate method
> seems to send 'update'  commands to pgsql. I have to keep looking,
> though, because deleting rows generates an ugly runtime error
> (Clear of selection failed ( PostgresSQL ERROR: current transaction is
> aborted, commands ignored until end of transaction block) ).

Make sure that you're using the latest versions of fpc.

And that error isn't that ugly. You have done something wrong,
thereafter postgresql closed the transaction, but you still tried to do
something else with that transaction. That's what it says.

Please try with fpc 2.1.1 or 2.0.4-rcx

Hello,

I've upgraded to 2.1.1 (from svn so that i could upgrade easier in the future).
I've started over to writte the small application, using a smaller
table. To sum up:
- i have a TdbGrid that gets properly populated with data read from a
PostgreSQL table,
with 4 fields :   ID serial primary key, NAME varchar(20),  AGE
numeric,  DT date .
A TdbNavigator is asociated to the dataset.
- insert seems to work
- update seems to work
- if the AGE field already has a value, I can't set it to empty
(NULL). It complaints
that :  ' ' is not a valid float value.   So, there is an issue with
NULL values.
- when i delete a row,  it asks me to confirm.   Later i get an error
when I press on
a button called "Save" which does:

procedure TForm1.Button1Click(Sender: TObject);
begin
   SQLQuery1.ApplyUpdates;
   SQLTransaction1.Commit;
end;

In the console it writes:

TApplication.HandleException Access violation
 Stack trace:
 $081F894D
 $081FDD77  TCUSTOMDBGRID__DOLAYOUTCHANGED,  line 1388 of dbgrids.pas
 $081FF899  TCUSTOMDBGRID__ENDLAYOUT,  line 2149 of dbgrids.pas
 $081FE3E2  TCUSTOMDBGRID__LAYOUTCHANGED,  line 1554 of dbgrids.pas
 $081FCB54  TCUSTOMDBGRID__ONDATASETCHANGED,  line 800 of dbgrids.pas
 $0820121C  TCOMPONENTDATALINK__DATASETCHANGED,  line 2703 of dbgrids.pas
 $081F563A
 $081F82A0
 $081F81ED
 $08106964  TCONTROL__CLICK,  line 1876 of ./include/control.inc
 $08158C8F  TBUTTONCONTROL__CLICK,  line 57 of ./include/buttoncontrol.inc
 $0815A6E5  TCUSTOMBUTTON__CLICK,  line 187 of ./include/buttons.inc
 $0815AAB1  TBUTTON__CLICK,  line 298 of ./include/buttons.inc
 $0815A8AA  TCUSTOMBUTTON__WMDEFAULTCLICKED,  line 242 of ./include/buttons.inc
 $0805D889
 $080FDE7B  TWINCONTROL__WNDPROC,  line 3399 of ./include/wincontrol.inc
 $0811B6C9  DELIVERMESSAGE,  line 3514 of gtkproc.inc


The Button1Click method is the only piece of code i've written manually. What
am I doing wrong?

The database tutorial in the wiki has indeed a section about PostgreSQL, but it
only explains how to obtain a read-only TdbGrid (which works for me,too), and
nothing about actually editing the data.


Cheers,
Adrian Maier

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to