i want to search two columns consecutively(FName and LName columns). I'm using the code below:
-----------
ElseIf cmbCAT.Text = "Full Name" Then
da = New OleDbDataAdapter("Select * from list where (FName = '" & txtSearch.Text & "', LName = '" & txtSearch.Text & "')", con)
------------
but it is not working. what's wrong with my code?
Clauses
Page 1 of 11 Replies - 1740 Views - Last Post: 13 July 2012 - 05:24 AM
Replies To: Clauses
#2
Re: Clauses
Posted 13 July 2012 - 05:24 AM
you need an operator such as AND or OR between your statements in the where clause. Proper SQL Syntax is
see how i seperated each condition with an AND or an OR statement. Try adding that and see if it works.
Also you will want to look at using parameratized queries instead of inline like that. You open yourself up to sql injection attacks.
SELECT <Columns> FROM <tables> WHERE <Condition1> AND <Condition2> OR <Condition3>.....
see how i seperated each condition with an AND or an OR statement. Try adding that and see if it works.
Also you will want to look at using parameratized queries instead of inline like that. You open yourself up to sql injection attacks.
This post has been edited by rgfirefly24: 13 July 2012 - 05:28 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|