| Author |
Topic  |
|
|
jplace
Starting Member
1 Posts |
Posted - 11/18/2012 : 18:33:07
|
I am trying to accomplish something like...
SELECT ItemID, ItemNumber, ItemDesc FROM ITEMS WHERE ItemDesc LIKE '%variable%'
The problem is I am using a parameterized query, so it is structure like...
rsItems_cmd.CommandText = "SELECT ItemID, ItemNumber, ItemDesc FROM ITEMS WHERE ItemDesc LIKE ?"
and then passing the parameter...
rsItems_cmd.Parameters.Append rsItems_cmd.CreateParameter("param1", 200, 1, 50, rsItems__Variable
(Where rsItems__Variable is a string of the value passed)
How do I use a LIKE command when passing a text string as a parameter?? |
|
|
jimf
Flowing Fount of Yak Knowledge
USA
2868 Posts |
Posted - 11/18/2012 : 18:40:31
|
Try WHERE ItemDesc LIKE '%'+rsItems_Variable + '%' This won't work if your paramater looks like 'A,B,C' (A delimited list). If that's the case, look at parsing the string and then joining to it using the function ParseValues, which can be found on this site.
Jim
Everyday I learn something that somebody else already knew |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
48076 Posts |
|
| |
Topic  |
|
|
|