I am writing a searching function, and have thought up of this query using parameters to prevent, or at least limit, SQL injection attacks. However, when I run it through my program it does not return anything:
SELECT * FROM compliance_corner WHERE (body LIKE '%@query%') OR (title LIKE '%@query%')
Can parameters be used like this? or are they only valid in an instance such as:
SELECT * FROM compliance_corner WHERE body LIKE '%<string>%'
(where <string>
is the search object).
EDIT: I am constructing this function with VB.NET, does that have impact on the syntax you guys have contributed?
Also, I ran this statement in SQL Server: SELECT * FROM compliance_corner WHERE (body LIKE '%max%') OR (title LIKE
%max%')` and that returns results.