MySQL Connector/.NET & Like

With the MySQL Connector/.NET, parameterized queries are performed like this:
dim sql as string = "SELECT * FROM table1 WHERE field1 = ?field1"

cmd.Parameters.Add("?field1", "Value")


Great.  What about LIKE statements?

dim sql as string = "SELECT * FROM table1 WHERE field1 like ?field1"

cmd.Parameters.Add("?field1", "Value")


The only way I've gotten this to work is:

dim sql as string = "SELECT * FROM table1 WHERE value1 like ?value1"

cmd.Parameters.
add("?value1", "%Value%")

Am I missing something?

Print | posted on Monday, November 07, 2005 2:20 PM

Feedback

No comments posted yet.
Title  
Name
Email (never displayed)
Url
Comments   
Please add 6 and 3 and type the answer here: