M
MB
Hi,
I am using a datagrid and the datagrid is filled through the SQL
query. The SQL query searches for the match in the database. The SQL
Query that i am writing is as follows
Dim selprod As String = "SELECT ProductID, ProductName FROM Products
WHERE ProductName LIKE '%prod%'"
but it is not working.
If I use the query this way(as given below) it works but I want to use
wildcard so that it searches thoroughly and provide with me with all
the records
Dim selprod As String = "SELECT ProductID, ProductName FROM Products
WHERE ProductName LIKE '" + prod + "'"
If i use LIKE '" +%prod%+ "'" or something sort of like this it doesnt
work either... any idea how it will work.
P.S My database is in SQL Server
Thanks in advance
MB
I am using a datagrid and the datagrid is filled through the SQL
query. The SQL query searches for the match in the database. The SQL
Query that i am writing is as follows
Dim selprod As String = "SELECT ProductID, ProductName FROM Products
WHERE ProductName LIKE '%prod%'"
but it is not working.
If I use the query this way(as given below) it works but I want to use
wildcard so that it searches thoroughly and provide with me with all
the records
Dim selprod As String = "SELECT ProductID, ProductName FROM Products
WHERE ProductName LIKE '" + prod + "'"
If i use LIKE '" +%prod%+ "'" or something sort of like this it doesnt
work either... any idea how it will work.
P.S My database is in SQL Server
Thanks in advance
MB