What would you like:
tblCustomerInfo.Info LIKE '%' + @SEARCH + '%'
(or edit the parameter value to include% first).
Otherwise, you either (the first sample), look for the letter "@SEARCH" (not the arg value), or insert some additional quotation marks in the query (second sample).
In a sense, it might be easier to have TSQL just use LIKE @SEARCH and process it at the caller:
command.Parameters.AddWithValue("@SEARCH","%" + searchString + "%");
Any approach should work.
Marc Gravell Mar 20 '09 at 6:02 2009-03-20 06:02
source share