Recent

Author Topic: Anyone has some sqlite examples  (Read 4562 times)

JanRoza

  • Hero Member
  • *****
  • Posts: 587
    • http://www.silentwings.nl
Anyone has some sqlite examples
« on: October 29, 2007, 07:12:03 pm »
Hi,

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');
dbgrid1.refresh;


and

Code: [Select]

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


and

Code: [Select]

tblAdresses.IndexFieldNames('Adres_Name');
dbgrid1.Refresh;


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?

Thanks!
 :?
OS: Windows 10 (64 bit) / Linux Mint (64 bit)
Laz: Lazarus 2.0.10 FPC 3.2.0
       CodeTyphon 7.2 FPC 3.3.1

 

TinyPortal © 2005-2018