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

Gianluigi bagonergi at gmail.com
Tue May 10 12:07:24 CEST 2022


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

>
> Which one? The quicky using the "(&1)" in the SQL parameter or the
> longer array expansion one. Because they both work here with sqlite3
> and postgres. And as far as I know I am using the native gd.db classes?
>

both of them:

Public Sub Button2_Click()

  Dim res As Result

  ' res = conn.Exec("select fldtitle from tbltest where flddepartment
in('Austria','Azerbaijan')") ' <-- Work
  res = conn.Exec("select fldtitle from tbltest where flddepartment in &1",
"(" & ["Austria", "Azerbaijan"].Join(",") & ")") ' <-- Not work
  ' res = conn.Exec("select fldtitle from tbltest where flddepartment in
(&1)", ["Austria", "Azerbaijan"]) ' <-- Not work
  If res.Available Then
    ListBox1.List = res.All("fldtitle")
  Endif

End

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


More information about the User mailing list