Page 1 of 1
Maybe a suggestion
Posted: Fri 16 May 2008 00:38
by jalin
I was trying to find the way to create dinamically the select statement of a SQL. Is there a way to create the SELECT statement using something like ADDWHERE or ORDERBY methods?
Thanks in advance
Jalin
Posted: Fri 16 May 2008 12:10
by Dimon
To create a query dynamically you can use the following TCustomMyDataSet methods:
AddWhere, DeleteWhere, GetOrderBy, SetOrderBy, FilterSQL.
You can find more detailed information about these methods in the MyDAC help.
Posted: Sat 17 May 2008 19:46
by jalin
These methods modify the SET ORDER BY and WHERE clauses but not the SELECT clause
Posted: Wed 21 May 2008 09:51
by Dimon
You should use the TCustomMyDataSet.SQL property and set the SELECT statement like this:
Code: Select all
MyQeury.SQL.Text := 'SELECT * FROM tablename';
Posted: Wed 21 May 2008 12:54
by jalin
Yes of course, this is the common way to do it and many times you can use the ADD method SQL.ADD('SELECT....ยด) but I was looking something more dinamic. Maybe Im not explaining my idea.
Posted: Wed 21 May 2008 13:34
by Dimon
Could you explain your idea in more details?