SqlDataSource configueration depending on URL params and dynamic SQL query

how to configure SqlDataSource  to use WHEN conditions only when required URL param is presented? (not using default param value)

for example:

URL: index.aspx?paramA=blah&paramB=blooh

then to use  SELECT * FROM blooh WHERE paramA='blah'

otherwise if no params present - use SELECT * FROM myTable

i.e. i want to display ALL records from the table

or variant B:

 URL: index.aspx?paramA=blah&paramB=blooh

then to use  SELECT * FROM blooh WHERE paramA LIKE 'blah'

otherwise if no params present - use SELECT * FROM index

 

is it possible?

 

0
Telepoozeeck
5/24/2007 5:31:53 AM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

1 Replies
702 Views

Similar Articles

[PageSpeed] 47

You should use a stored procedure and then in your stored procedure you can check to see if the parameter is the default value or not. The alternative, which would be more of a hack, would be to modify the ad hoc query in the SqlDataSource.Selecting event.


Todd Casey, MCSD .NET
http://www.dagrind.com
0
vhariable
5/24/2007 12:54:02 PM
Reply: