[SOLVED] SQL string with SQLite-Zeos lazarus / 16-Databases ---------------------------------------------------------------------- rcantagalli · 2013-01-21 16:07 Hi guys, I need your help in a little basic problem but I try until now several diferent expressions without success. Lets begin with: IDE Lazaus 1.04 Zeos 7.03 SQLite 3 V 3.7.15.2 I have a form with DBGrid and the components TZConnection, TZQuery, TZTable, TDatasource, my SQL string input on TZQuery is a tradicional select * from TB12. I put 2 buttons (lets call bt1 and bt2) to make order in database asc for two fields (lets call field1 and field2). When I click in bt1 or bt2 I have no changes on DBGrid. (follow the last try) procedure TfrmFornecedor.bt1Click(Sender: TObject); begin   frmFornecedor.DBGrid1.Enabled:=false;   varsql:='select * from T12 order by field1';   dmCompras.queT12.Close;   dmCompras.queT12.SQL.Clear;   dmCompras.queT12.SQL.Add(varsql);   dmCompras.queT12.ExecSQL;   dmCompras.queT12.Open;   frmFornecedor.DBGrid1.Enabled:=true; end;    (same for field 2) Thanks for any help or direction. Rene ---------------------------------------------------------------------- IndianaJones · 2013-01-21 20:23 @rene, Can you add 'DESC' (descending) or 'ASC' (ascending) after the 'ORDER BY field1' string and try it like that? Also you dont need ExecSQL line, just open is enough. Regards. ---------------------------------------------------------------------- rcantagalli · 2013-01-21 22:50 @IndianaJones, thanks for quickly reply, I put DESC in bt2 and ASC in bt1, but doesn't work, datagrid show the same data. I don't understand why this not work. It's possible have some problems with ZeosLib? I make same thing with TSQL3Connection instead TZConnection and this query works fine. Do you know some routine to test this ZeosLib? Thanks again for your help. Rene ---------------------------------------------------------------------- IndianaJones · 2013-01-22 05:24 Okey rene, try like this, put an TZQuery double click on it, add all the fields to the query. Then execute the query. Regards. ---------------------------------------------------------------------- rcantagalli · 2013-01-22 15:17 Hi IndianaJones, again the same thing, no change. Attached are the files of this example, if you or someone will can try on your machine and see if have the same result I will apreciate. If you have no problem with your configuration, please let me know Lazarus and Zeos version to try here. Thanks for your help, and I'm sorry by my frustation. ---------------------------------------------------------------------- sylvanus67 · 2013-01-22 19:42 in the object inspector dbgrid1/datasource/dmCadastro.dsT12 and dbgrid1/datasource/dataset/dmCadastro.queT12 ---------------------------------------------------------------------- rcantagalli · 2013-01-22 20:07 @sylvanus67 Thank you very much, a single error cause a big headache. For the others people understand, my Dataset property was to tbT12 (Ztable), it must be queT12 (Zquery). Thanks for all, Thanks to be patient with me guys.  Moderator/Admin please change this status to close and concluded. (I'm new in this forum ok?) Best Regards ---------------------------------------------------------------------- BigChimp · 2013-01-22 20:14 Glad you got the problem fixed. Quote from: rcantagalli on January 22, 2013, 09:07:13 pmModerator/Admin please change this status to close and concluded. (I'm new in this forum ok?) I'm not a moderator/admin, but: you can edit your first post and add [SOLVED] at the beginning of the title to indicate it is solved. Thanks for reporting success Regards, BigChimp ---------------------------------------------------------------------- IndianaJones · 2013-01-22 23:05 QuoteThanks for your help, and I'm sorry by my frustation.This is a forum man, feel free to ask, share, blabla. So I am glad you solved your problem, I havent looked at your example. Regards.