Click here to Skip to main content
15,905,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,
string qryDetails = "select * from Product_Details where GatePassNo='" + ViewState["GPN"] +"' and Status ='Under Repair' ";

In this query if i want to write the two value of status like Status = Under Repair and status = Warrenty Under Repair how will i write. Please help
Posted

Hi,
Try this
string qryDetails = "select * from Product_Details where GatePassNo='" + ViewState["GPN"] +"' and Status ='Under Repair' or Status ='Warrenty'  "
 
Share this answer
 
Comments
Member 10578683 8-Apr-14 4:10am    
Thanks to both of you. It is working.
SQL
select * from Product_Details where GatePassNo='" + ViewState["GPN"] +"' and (Status ='Under Repair' or Status ='Warrenty')

You need to put on braces on OR condition as this is OR for status value only
 
Share this answer
 
You can also use SQL IN Operator[^].
So your query will be:
string qryDetails = "select * from Product_Details where GatePassNo='" + ViewState["GPN"] + "' and Status IN ('Under Repair', 'Warrenty Under Repair')";

Hope that helps!
 
Share this answer
 
Comments
Member 10578683 8-Apr-14 4:12am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900