[Gambas-user] Query for sorting not work
T Lee Davidson
t.lee.davidson at gmail.com
Sat Sep 3 18:26:53 CEST 2022
On 9/3/22 08:26, gian via User wrote:
> Hi List,
>
> Is anyone able to explain to me why the most correct query (I think) for sorting the columns is the one that is not working?
> See attached, to see the malfunction you need to comment out the first sort routine and uncomment the second one.
>
> Thank you
>
> Gianluigi
It does not work because SQLite does not understand a single-quoted column name. Data values should be single-quoted but not
column names. I think the code misuses the Connection.Find method. Try using the .Exec method with the standard Subst function, eg.:
If GridView1.Columns.Ascending Then
$hResult = $hConn.Exec(Subst("select * from tuser ORDER BY &1 ASC", aArg[$iCurrentColumn]))
Else
$hResult = $hConn.Exec(Subst("select * from tuser ORDER BY &1 DESC", aArg[$iCurrentColumn]))
Endif
--
Lee
More information about the User
mailing list