[Gambas-user] Extracting fields from a Result

Zainudin Ahmad mail.gambaspi at gmail.com
Wed Jan 3 05:43:34 CET 2018


Hi

You can see this video (
https://drive.google.com/open?id=1jq6I26ykS5Mkr3L2oPA1D15ZtjLt2_S3)

  Debug hRes.Fields.Exist("\"TxtMyDb\"") ---> true
  Debug hRes.Fields.Exist("TxtMyDb")  ----> false

I think gambas not fully support for case sensitive(for postgres) field
name. I don't know about postgres I think maybe the recommended way you
should write your field name with lower case name.

you can see in that video, doing this :

 Debug hRes.Fields["name"].name
 Debug hRes.Fields["NaMe"].name

it's no different

I think this is also possible :

  For Each hRes
    Debug hRes!Name
    Debug hRes!NaMe
  Next

if you doing hRes!txtMasterDatabase or hRes!txtMasterDATABASE or other it's
mean you must have a field name with lower case name in your table.

sorry for my english, I hope that can help.

On Sun, Dec 31, 2017 at 8:44 AM, Doug Hutcheson <owlbrudder at gmail.com>
wrote:

> 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
>
>
> --------------------------------------------------
>
> This is the Gambas Mailing List
> https://lists.gambas-basic.org/listinfo/user
>
> Hosted by https://www.hostsharing.net
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180103/1044e955/attachment.html>


More information about the User mailing list