Dear All
I had developed an application which consists of one Textbox and a gridview, whenever i search rows in gridview i may able to search only single row at once , but my intension is if i search for second row in the textbox the first row should be checked .
Below is my search code :
if(txtsearch.text!="")
{
Empcode=txtsearch.text;
da=new sqladapter("select Empcode,Name FROM Employee where empcode='" + empcode + "' OR Name LIKE '" + empcode + "'+'%' order by empcode", conn);
da.Fill(ds);
Gridview.DataSource = ds;
Gridview.DataBind();
}
thanks in advance
Regards
Sandeep Kodepaka
Loading
Gohil JayendrasinhPosted Mar 16, 2012, 1:44 AM
Store your search value like
Empcode += txtsearch.text +","; Then trim it with last ',' And then use select query like Ex.SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...)
da = new sqladapter("select Empcode,Name FROM Employee where empcode in '" + empcode + "' OR Name LIKE '" + empcode + "'+'%' order by empcode", conn); If it's helpful for you then please check Accepted Asnwers
brunda kPosted Mar 15, 2012, 11:09 PM