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

Gianluigi bagonergi at gmail.com
Tue May 10 11:50:57 CEST 2022


Il giorno mar 10 mag 2022 alle ore 11:24 bb <adamnt42 at gmail.com> ha scritto:

> On Tue, 2022-05-10 at 11:04 +0200, Gianluigi wrote:
> > Il giorno mar 10 mag 2022 alle ore 05:18 Safiur Rahman
> > <isafiur at gmail.com>
> > ha scritto:
> >
> > > Hi
> > >
> > > That cannot be the answer. The array can be of variable count and
> > > count
> > > may go to twenty or thirty.
> > >
> > >
> > I thought it was implied, you can do something like this:
> >
> > Public Sub Button2_Click()
> >
> >   Dim aRes As New Result[11]
> >
> >   For i As Integer = 0 To 10
> >     aRes[i] = conn.Find("tbltest", "flddepartment = &1 ",
> > xCountry[i])
> >     If aRes[i].Available Then ListBox1.Add(aRes[i]!fldtitle)
> >   Next
> >
> > End
> >
> > Regards
> > Gianluigi
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> Gianluigi,
> That is still overcomplicating the problem. He is not constructing the
> WHERE part of the call properly.
> To cut it short,
>
> res = conn.Exec("select fldtitle from tbltest where flddepartment in
> &1", ["Austria", "Azerbaijan"])
>
> is missing the "()" that are needed for the SQL "in" construct.
>
> The answer is
>
> res = conn.Exec("select fldtitle from tbltest where flddepartment in
> (&1)", ["Austria", "Azerbaijan"])
>
> or possibly better in order to keep database independance truely true,
>
> res = conn.Exec("select fldtitle from tbltest where flddepartment in
> &1", "("&["Austria", "Azerbaijan"].Join(",")&")")
>
> ...
>

Bruce,

it seems that your queries here are not supported (gb.db: DB_Format:
unsupported datatype: -58432600)

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


More information about the User mailing list