0

I want to know what is the correct SQL query statement for "SELECT LIKE" in the TableAdapter query configuration wizard with a parameter in visual studio and want to add a query for search purposes because it's really hard to find the answer I need on the internet so please can someone help me

THIS IS WHAT I WROTE:

SELECT * FROM table1 WHERE name LIKE '%'+@name+'%'

but it doesn't work

blewwwuuu
  • 23
  • 2

1 Answers1

0

As per this answer, you can't use + to concatenate strings in MySQL; instead, use the CONCAT function:

SELECT * FROM table1 WHERE name LIKE CONCAT('%', @name, '%')
Bradley Grainger
  • 27,458
  • 4
  • 91
  • 108