Question : asp.net mssql - I have a dataosource that initially searches and pulls in a full query is there a way to alter the dynamiccaly the where clause.

I have a dataosource that initially searches and pulls in a full query and populates a listview, the user can page thru the records to find what they want. But I also have build a searc form that allows the user to search for specfic detail. How can I alter the where clause to use the querystring to search for the specfics.

Basically I want to use this where clause:
 Where E.IsLockedOut = 'False' .....which pulls in the top 100 records and all the fields.
is there away to switch alter the where clause of the search routine (form) was filled out and the
and an attach querystring was filled in??

Answer : asp.net mssql - I have a dataosource that initially searches and pulls in a full query is there a way to alter the dynamiccaly the where clause.

try something like this:

string sqlQuery="Select * from table where ";
string whereClause = String.Empty;

if(querystringvalues=null){
whereClause = "E.IsLockedOut='False'";
}
else{
whereClause="create with querysting clause";
}
SqlDataSource1.SelectCommand = sqlQuery + whereClause;
Random Solutions  
 
programming4us programming4us