Any samples for using render_sql in .NET?

how the user’s query criteria collected in UI be sent to dhtmlx connector and than feedback on dhtmlx grid?

my scenario (I think it’s very common for most developers):
UI would have a section (at upper) to collect user’s criteria. e.g. txn id, book_name, author,etc.
Then a section at lower would be a data grid. Once user press “Search” button, those records at database matching the criteria would be load into the grid.

It’s seems that it’s a kind of dynamic SQL statement which should be passed to dhtmlx connector.
I think I might use render_sql method. However, I don’t find an example on how to apply it in .NET.

P.S. I have checked most cases in net_dv1 .NET sample and don’t see how to handle dynamic connector SQL statement (Or I should use render_sql at client-side? then what should I set at connector in .ashx?)

Any help would be appreciated.


connectors for .net does not have separate method for dynamic sql.
You may pass query right to the constructor of the connector
gridBasicSQLConnector.ashx:dhtmlxGridConnector connector = new dhtmlxGridConnector( "SELECT ISO, PrintableName FROM Country",//query "UID",//primary key dhtmlxDatabaseAdapterType.SqlServer2005, ConfigurationManager.ConnectionStrings["SamplesDatabase"].ConnectionString );

Is it possible to pass the whole string to the connector like the following:

dhtmlxGridConnector connector = new dhtmlxGridConnector(
“UID”,//primary key

where string_SQLStatement is passed form outside.

then code from outside .aspx:

//construct my SQL statement based on user’s criteria input

string_SQLStatement = …

var dp = new dataProcessor(“GridViewConnector.ashx”);

//load to grid at the very last or on button request

Please Comment.


yes, it’s possible.
But i don’t think you can use Tools.EscapeQueryValue for the whole query. It escapes single quotes, and you may get an incorrect sql.
e.g. from
Tools.EscapeQueryValue(“SELECT … WHERE name=‘value’”)
you’ll get
SELECT … WHERE name=’‘value’’

Then, any other better ways of passing SQL Statement to connector.ashx apart from using
Tools.EscapeQueryValue and context.Request.QueryString?

Thanks a lot!