Newbie-Filling a table but selected fields

enonod

Well-Known Member
Licensed User
Q1...
I am trying to get going with SQL and a table. I notice the simplicity of filling the table with a single command 'TableExecute'.
However I wish to fill the table but only with 2 of the several fields. Is there a way to do this (and not necessarily in the order the fields appear in the Database Table), fairly simply please?

Q2...
There appear to be no equivalents to 'AbsolutePosition' etc as used in ADO, to enable keeping track when loading say a page at a time from a long database table. Have I missed something?

Thanks in advance
 

Erel

Administrator
Staff member
Licensed User
A1: You can use any SELECT query with ExecuteTable.
If you want to show 2 fields:
Cmd.CommandText = "SELECT field1, field2 FROM table1"
Cmd.ExecuteTable(...)
A2: You can use the built-in SQLite row index ROWID.
It is always available.
Cmd.CommandText = "SELECT field1, field2 FROM table1 WHERE ROWID > 50 AND ROWID <70"
Cmd.ExecuteTable(...)
 

enonod

Well-Known Member
Licensed User
That is wonderful thank you Erel. I somehow thought that the whole database table would be loaded into the table object. It is obvious now you have explained.
 

enonod

Well-Known Member
Licensed User
Sorry to be a nuisance.
Well it did seem obvious. I have achieved as you suggested.
However I didn't explain well enough. I require the whole table of data to be accessed, but, I only want to 'display' two fields, whilst being able to refer to the others.
A tiny bit more help would be appreciated.
 

enonod

Well-Known Member
Licensed User
Why does every answer make me feel simple?
Great idea, thank you agraham for some lateral thinking.
 

enonod

Well-Known Member
Licensed User
Thank you Erel, for another good suggestion. Spoilt for choice.
 
Top