Programming => Databases => Topic started by: JanRoza on October 29, 2007, 07:12:03 pm

Title: Anyone has some sqlite examples
Post by: JanRoza on October 29, 2007, 07:12:03 pm

I just installed sqlite 3 in Lazarus and am experimenting with it.
Setting up databases and forms with grids and fields is no problem but I have trouble sorting an sqlite table.
I created a table Adresses in sqlite and also an index called Adres_Name which indexes table Adresses on field Name.

Unfortunately no examples are provided with sqlite and I tried several things to get my dbgrid sorted on Name but all without succes.

On the form I've created a dbgrid and a number of dbedit fields all based on dataset dsAdresses.
dsAdresses is based on tblAdresses (which points to sqlite table Adresses)

I've tried constructions like

Code: [Select]

tblAdresses.ExecSQL('SELECT * FROM Addresses ORDER BY Name');


Code: [Select]

tblAdresses.ExecuteDirect('SELECT * FROM Addresses ORDER BY Name');


Code: [Select]


but nothing works.
Can anyone provide me with an example to activate an index from code and how to make this index ascending or descending?

TinyPortal © 2005-2018