3
Answers

retrive data using two textboxes

Srinivas Rao

Srinivas Rao

8y
310
1
 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)