Something like this.
http://code.google.com/p/squiggle-sql/wiki/Tutorial.
This is required for cases where It is required to build complex sql from the user input from UI. Currently in the project I am working is using String Manipulation which looks ugly and is difficult to maintain.
The Query Builder control enables you to define your query for scenarios where you need server-side filtering based on criteria defined at run time. You can use it with your database connectors by providing the query based on the dynamic selection.
Executing dynamic SQL using sp_executesql sp_executesql is an extended stored procedure that can be used to execute dynamic SQL statements in SQL Server. we need to pass the SQL statement and definition of the parameters used in the SQL statement and finally set the values to the parameters used in the query.
You have to build your query dynamically, at the beginning of the method check whether id is null or equal 0 . To make it easier you can use trick in where clause with 1=1 so where clause can be included all the time in the query.
The query builder is a utility to generate CQL queries programmatically.
Try DbExtensions, available as NuGet package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With