Delete Query String in Oledb
-
hi, there are two query string i want to combine them string str = "xyz"; double waist = 123; string query1 = "delete from Trouser where Company = " + "'" + str + "'"; string query2= "delete from Trouser where Waist = " + waist ; i want to make them one using "where" clause. plz help me i will be very thankful to u.
-
hi, there are two query string i want to combine them string str = "xyz"; double waist = 123; string query1 = "delete from Trouser where Company = " + "'" + str + "'"; string query2= "delete from Trouser where Waist = " + waist ; i want to make them one using "where" clause. plz help me i will be very thankful to u.
If we ignore the gaping hole in the security of your application (May I suggest that you read SQL Injection Attacks and Tips on How to Prevent Them[^]) you can easily combine the two statements into one by using
OR
in theWHERE
clause. e.g.DELETE FROM Trouser WHERE Company = 'abc' OR Waist = 123
That will delete the row where any of the conditions are true. Compare this with
AND
where all the conditions must be true in order for the row to be deleted. Does this help?
My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More