Reputation: 7623
I have a data adapter that was created from my data set. i want to do this query:
Select Body
WHERE Body Like '%@INPUTTEXT%'
.
how can i do it? i want the "@INPUTTEXT" to be a parameter but because of the "' " it's a simple text...
Upvotes: 3
Views: 2068
Reputation: 1121
or in Linq
dc.Body.where(a+> a.body.contains("InputText")).Select(a=>a.body).ToList();
Upvotes: 0
Reputation: 7541
I've done this before to do what you're asking:
string cmdText = "select * from table where column like @INPUTTEXT";
SqlConnection conn = new SqlConnection(connString);
SqlCommand cmd = new SqlCommand(cmdText,conn);
cmd.Parameters.Add(new SqlParameter("@INPUTTEXT", string.Format("%{0}%",INPUTTEXT)));
Upvotes: 6