[Lazarus] What is 'Restriction Browser'?

Graeme Geldenhuys graemeg.lists at gmail.com
Wed May 28 09:47:11 CEST 2008


Hi.

Following Damien's instructions I have DROPped my original table and
created a new one in it's place:

CREATE table registration (
fname char(50),
sname char(50),
enquiryreferencenumber INT4 PRIMARY KEY DEFAULT nextval('reg_seq'))
WITHOUT OIDS;

I have run my INSERT Query under PQConnection1 using the following arguments:

      sqlq:='INSERT INTO registration (fname,sname) ';
      sqlq:=sqlq+'VALUES
('''+FName.Text+''','''+SName.Text+''')RETURNING
enquiryreferencenumber;';
      PQConnection1.Connected:=True;
      PQConnection1.ExecuteDirect('Begin Work;');
      PQConnection1.ExecuteDirect(sqlq);
      PQConnection1.ExecuteDirect('Commit Work;');
      PQConnection1.Connected:=False;

Then I have attempted to retrieve the enquiryreferencenumber using
SQLQuery1 as follows:
      SQLQuery1.SQL.Text:='SELECT enquiryreferencenumber FROM
registration WHERE fname='''+fname.Text+''' AND
sname='''+sname.Text+'''ORDER BY enquiryreferencenumber DESC LIMIT
1;';
      SQLQuery1.Open;
      enquiryreferencenumber.Text:=SQLQuery1.FieldByName('enquiryreferencenumber').AsString;
      SQLQuery1.Close;

This gives me the following error:
     SQLQuery1: Field not Found: "enquiryreferencenumber"

Can anyone help?

Is it possible that the fact that the field 'enquiryreferencenumber'
is an integer and I'm accessing it AsString?

Running: "SELECT enquiryreferencenumber from registration;" in psql on
the linux machine give the following output:

 enquiryreferencenumber
------------------------
                     14
                     15
                     16
                     17
                     18

Any Ideas?



More information about the Lazarus mailing list