[Gambas-user] Extracting fields from a Result

Doug Hutcheson owlbrudder at gmail.com
Sat Jan 6 04:31:15 CET 2018


On Fri, 2018-01-05 at 14:23 +0100, Benoît Minisini wrote:
> Le 31/12/2017 à 02:44, Doug Hutcheson a écrit :
> > Hi everyone.
> > 
> > I have successfully connected to my PostgreSQL database and the
> > field 
> > count in the Result from my query is correct, but all my attempts
> > to 
> > extract data from the fields have failed. I am cobbling together
> > code 
> > from the wiki and from other posts here, but I am still missing
> > something.
> > 
> > The table I am reading from has exactly one row and 35 fields. The
> > first 
> > field is named txtMasterDatabase.
> > 
> > My code declares a Field and a Result as follows:
> >            Dim $Field As ResultField
> >            Dim $Result As Result
> > 
> > The query works correctly:
> >             $Query = "Select * From abpa.tblParameters"
> >             $Result = $Con.Exec($Query)
> > 
> > The field count is correct - 35:
> >             Message("Fields count = " & $Result.Fields.Count)
> > 
> > Now I try to loop through the fields in the result:
> >             For Each $Field In $Result.Fields
> >              Message($Field.Name)
> >             Next
> > 
> > The problem occurs on the For Each line in that the Basic IDE
> > displays 
> > an error at this point:
> > Unknown field: txtMasterDatabase in FRMStart:41
> > 
> > As I said above, the first field in the tuple is named 
> > txtMasterDatabase, so Gambas is at least seeing it. Why is it
> > telling me 
> > the field is unknown?
> > 
> > Thanks for any help and Happy New Year,
> > Doug
> > 
> > 
> 
> 
> Can you send me a SQL dump of that table?
> 
Hi Benoît.

I have attached the dump of that table and the test harness I used to
try to read it. I hope these are useful.

Kind regards,
Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180106/cb27d093/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tblparameters.sql
Type: application/sql
Size: 2214 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180106/cb27d093/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PostgreSQL_test-0.0.1.tar.gz
Type: application/x-compressed-tar
Size: 12506 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180106/cb27d093/attachment-0003.bin>


More information about the User mailing list