favc4
Posts: 30
|
| Posted: 05/30/2006, 4:06 AM |
|
Hi there, does anyone know why when getting the grid DataSource.SQL property I get something like this:
SELECT TOP {SqlParam_endRecord} *
FROM qryLEADS {SQL_Where} {SQL_OrderBy}
Instead of something like this:
SELECT *
FROM tbLEADS
WHERE IdLead = 1
The issue is that I need to get the specific SQL statement provided by the search form, any advise?
Thanks in advace for your kind attention
_________________
Programming win32 and went crazy... |
 |
 |
Benjamin Krajmalnik
|
| Posted: 05/30/2006, 9:39 AM |
|
This is correct.
The grids use tokens which are replaced by the backend classes.
In this case, {SqlParam_endRecord} will be replaced by hte number of records
you sepcified for the grid, {SQL_Where} will be replaced by your where
clause (if one exists), and {SQL_OrderBy} by your order clause.
You can further manioulate these in the BeforeBUildSelect statement.
You would manipulate EventCaller.Where and EventCaller.Order.
At this stage, the dynamic code has not populated the where and order
clauses.
I use this extensively to dynamically modify the qieriees absed on user
level permissions stored on database tables where the stock security model
in CCS is not sufficient.
|
|
|
 |
favc4
Posts: 30
|
| Posted: 05/30/2006, 1:43 PM |
|
Thanks for your insights but I am working on a market intelligence app so I need the specific SQL sentence to run in exactly identical in the future and then compare results; this queries are end user defined on the fly, so how could I get the final query stated in plain SQL?
_________________
Programming win32 and went crazy... |
 |
 |
peterr
Posts: 5971
|
| Posted: 05/31/2006, 12:20 AM |
|
Please try this code in the "AfterExecuteSelect" event:
Response.write Sender.Connection.lastSQL
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
favc4
Posts: 30
|
| Posted: 05/31/2006, 2:06 AM |
|
Works great, I am getting something like this
SELECT TOP 15 * FROM qryLEADS WHERE NombreCompania like '%zapato%'
The only thing I am having trouble with is that later on, I save this output and when in run-time under BeforeBuildSelect event I do Grid1.DataSource.SQL = varSQL (varSQL have that SQL string) I get the same results *BUT* the grid navigator show many more pages accordingly to the desing-time object DataSource wich returns many more rows.. how should I work around this?
Thank you very very much for your kind help
_________________
Programming win32 and went crazy... |
 |
 |
peterr
Posts: 5971
|
| Posted: 05/31/2006, 3:29 AM |
|
You would also need to assign a value to CountSQL. Please search the forums for CountSQL as there are discussions about this.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |