[Lazarus] Postgres database again...

Dave Coventry dgcoventry at gmail.com
Tue May 27 13:05:49 CEST 2008


Graeme,

If I do as Damien suggests and use:

PQConnection1.ExecuteDirect(''INSERT INTO Foo (Caption) VALUES (''A
caption'') RETURNING uID;')

and, assuming it returns the field uID, how do I place the uID field
into an edit box(read only of-course!).

On Tue, May 27, 2008 at 12:43 PM, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
> Dave Coventry wrote:
>> Okay, just supposing that I have the SQL Queries working ok, how do I
>> access the fields from inside Lazarus?
>>
>> If I query using "SELECT * FROM registration", where do the resultant
>> fields end up?
>>
>> Or perhaps I was on the right track and they ARE accessible from
>> SQLQuery1.Fields[i].AsString?
>
>
> Here are step-by-step instructions in using Databases with Lazarus
> (normal Delphi style).
>
> http://z505.com/cgi-bin/powtils/docs/1.6/idx.cgi?file=fcldbnotes
> http://z505.com/cgi-bin/powtils/docs/1.6/idx.cgi?file=index&unit=sqldb
>
>
> A quick search on the Lazarus wiki found the following. I think they
> might be handy as well.
>
> http://wiki.lazarus.freepascal.org/Contacts_Database
> http://wiki.lazarus.freepascal.org/Databases
> http://wiki.lazarus.freepascal.org/Databases_in_Lazarus
>
>
> Here is a post I found in the lazarus mailing list. There are many more.
>
>
> ------------[ copy ]----------------
> On Mon, 4 Feb 2008, el stamatakos wrote:
>
>  > >
>  > > Hi,
>  > >  I am working with a database and I am doing the following
>  > >
>  > > tFile:string;
>  > >
>  > > tFileName:=mainForm.SQLQuery1.FieldValues['tFileName'];
>
> You should never use FieldValues, this is a horrible construct which Delphi
> introduced for Visual Basic  "compatibility".
>
> You should use
>   tFileName:=mainForm.SQLQuery1.FieldByName('TFileName').AsString;
> instead.
>
> Michael.
> ------------[ end ]----------------
>
>
> Regards,
>   - Graeme -
>
>
> _______________________________________________________
> fpGUI - a cross-platform GUI toolkit using Free Pascal
> http://opensoft.homeip.net/fpgui/
>
>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>



More information about the Lazarus mailing list