Srinivas Rao

Srinivas Rao

  • NA
  • 76
  • 17.2k

retrive data using two textboxes

Mar 2 2016 3:22 AM
 hi,i want to retrive the data from database using two textboxes by clicking on a search btn.
#.)One textbox is for  "EmpId" another Textbox if for "EmpName" 
#.)there is a "OR" btwn two textboxes.
#.)with the below query "iam able to retrive data from "DB" if i enter data in both textboxes.",but
## I want the query for retrivng data i.e same data from db and show in the gridview,by using the singletextbox or both textboxes . 
  
 
 
#.)Gridview
Id      EmpId       FirstName        MI        LastName  
 
 
SelectCommand="SELECT [id], [EmpId], [FirstName], [MI], [LastName] FROM [Employees] WHERE [EmpId] like CAST(@EmpId as nvarchar) + '%' OR FirstName like @FirstName + '%' "
 
if any are changes are required to the above query  
pls reply ,
 

Answers (3)