[Gambas-user] How to write sql query in gambas way

Gianluigi bagonergi at gmail.com
Mon May 9 23:00:03 CEST 2022


Il giorno lun 9 mag 2022 alle ore 17:56 Safiur Rahman <isafiur at gmail.com>
ha scritto:

> Hi
>
> I get result when I execute the following query:
>
> Dim res As Result
>   res = conn.Exec("select fldtitle from tbltest where flddepartment
> in('Austria','Azerbaijan')")
>
> But I don't get result when I execute the following query:
> res = conn.Exec("select fldtitle from tbltest where flddepartment in &1",
> ["Austria", "Azerbaijan"])
>
> How can I write this query properly in gambas passing an array argument?
>
> (Attached a project to demonstrate)
>
> --
> Regards
> Safiur Rahman
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>

You can get the result like this:

res = conn.Exec("select fldtitle from tbltest where flddepartment = &1 or
flddepartment= &2", xCountry[3], xCountry[4])

or:

res = conn.Find("tbltest", "flddepartment = &1 or flddepartment= &2",
xCountry[3], xCountry[4])

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220509/c07dc3ec/attachment.htm>


More information about the User mailing list