September 19, 2005 at 8:33 pm
I need an example on how to use SQL 2000 syntax to build a user-friendly SQL WHERE syntax for building custom reports in .NET......
I have the following columns that need to mix-n-match (within reason). They inturn 'load' comboboxes on a Win-Form, not ASPX.
Some of the columns are: TimeBegin, TimeEnd, FName, MName, LName, Age, Height, Weight, State, City, Zip, etc.........
So a typical user might search BETWEEN 'TimeBegin' AND 'TimeEnd' WHERE 'FName' AND/OR 'Age' AND/OR ...
They might skip the 'Time' altogether and search by any combination of the other columns....
I've attempted this in .NET C# and found using 'IF' statements much too complicated. I'm hoping SQL will not only simply the task, but also add better performance.
September 19, 2005 at 8:39 pm
Your basically trying to build a dynamic search.
where some of the fields in the where clause are optional.
this will help you
http://www.sommarskog.se/dyn-search.html
Or you can performan parameterized queries from within .Net where you use embedded sql, and build your query in your application.
September 21, 2005 at 7:41 am
Another option is to create a stored procedure in SQL that will bring back your complete recordset. Bring in the recordset through your application, and then use the rowfilter property to filter the dataset according to the user's options.
HTH,
Sandi
September 21, 2005 at 4:36 pm
Most Excellent, Thank You...............
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply