On Monday 27 March 2006 16:58, johnf wrote:
> This may sound rude but does anyone actually use SQLdb with Postgres. I
> ask because I think it does not work either from code or a datamodule.
> Below is a sample of my code and the only difference between the code will
> be '*' vs 'custno,company' in the select statement. I get the following
> error message: clear of selection failed(Postgres: Error: current
> transaction is aborted, commands ignored until end of transaction block)
>
> The Postgres log shows 'update arcust set custno='FWR', company
> ='NICKERSON' where'
>
> There is nothing after the 'where'.
>
>
> this does work and notice the '*' in the select statement:
> CreateFTransaction;
> CreateFQuery;
> sqlunit.Fconnection.Transaction:=sqlunit.ftransaction;
> fquery.SQL.Clear;
> fquery.SQL.Add('Select * from arcust where custno = ''FWR'' ');
> fquery.open;
> self.Edit1.text:=fquery.FieldByName('custno').AsString;
> self.Edit2.text:=fquery.FieldByName('company').AsString;
>
> end;
>
> procedure TcustForm.Button1Click(Sender: TObject);
> var mystr:string;
> begin
> with fquery do
> begin
> fquery.Edit;
> sqlunit.fQuery.FieldByName('company').AsString:=self.edit2.text;
> post;
> applyupdates;
> end;
> sqlunit.ftransaction.Commit;
> sqlunit.fquery.Close;
> sqlunit.fTransaction.endTransaction;
>
> end;
>
>
> below does not work notice I am not using a '*' but selected fields:
> CreateFTransaction;
> CreateFQuery;
> sqlunit.Fconnection.Transaction:=sqlunit.ftransaction;
> fquery.SQL.Clear;
> fquery.SQL.Add('Select custno,company from arcust where custno = ''FWR''
> '); fquery.open;
> self.Edit1.text:=fquery.FieldByName('custno').AsString;
> self.Edit2.text:=fquery.FieldByName('company').AsString;
>
> end;
>
> procedure TcustForm.Button1Click(Sender: TObject);
> var mystr:string;
> begin
> with fquery do
> begin
> fquery.Edit;
> sqlunit.fQuery.FieldByName('company').AsString:=self.edit2.text;
> post;
> applyupdates;
> end;
> sqlunit.ftransaction.Commit;
> sqlunit.fquery.Close;
> sqlunit.fTransaction.endTransaction;
>
> end;
Sorry for my frustration. I guess if I include the primary key it works.
John
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives