Topic: need help for displaying data

Hi friend,
           Would you like to guide in a problem?
Is there way to show data on tablegrid of a table using script? For example I have project with a form, form1 and a tablegrid1 and a table sales with three columns, date, items and value. How can I show data in table sales on tablegrid1 using script.
?
Thanks

Re: need help for displaying data

Yes it is possible to load data via script but why would you want to load it via script when you can load data on the Settings of the tablegrid1? Another option is to load data using search button with corresponding filters.
Here's a sample snippet of populating grid via script.

Form1.Tablegrid1.dbSQL := 'SELECT `date`,`items`,`value` FROM `sales`';
Form1.TableGrid1.dbSQLExecute;
brian

Re: need help for displaying data

You can also you use SQLQUERY on a button action.

Re: need help for displaying data

Thank you ehwagner and brain.zaballa.
I used following statement which had given my desired result.
Tsales.TableGrid1.dbSQL:= 'SELECT `sdate` "Date",`name` "Costumer",`sitem` "Cold Drink",`svalue` "Price" FROM `sales` where sales.id_Category=6 ';
Tsales.TableGrid1.dbSQLExecute;

This statement worked very well but my problem which need to solve. I want to get more sales.id_Category= 6 , sales.id_Category= 2, sales.id_Category= 8  etc, etc
How will I type statement?
Secondly, I can I get other field of other table in same same statement.
Thank you all in advance.

Re: need help for displaying data

unforgettable,
Just place the word OR in between.

sales.id_Category= 6 or sales.id_Category= 2 or sales.id_Category = 8

Re: need help for displaying data

Secondly, I can I get other field of other table in same same statement.

To include other field/s from other table, you can use join statement.

brian