Friday, August 22, 2008

If condition in Condition in AccessDataSource / SQLDataSource in C#

I like to put condition in datasource , if there is a parameter(ie default.aspx?aaa=Y) run one sql if there is no parameter(ie default.aspx) then run another sql. how to put sql command in following selectcommand.
 
 
solution:
 code behind (e.g. in the Page_Load method):
 
if (Request.QueryString["genTY"] == "...")
  AccessDataSource5.SelectCommand = "..."
else
  AccessDataSource5.SelectCommand = "..."


Get ideas on sharing photos from people like you. Find new ways to share. Get Ideas Here!

No comments: