I need to fetch the records based on a 'like' match against a set of records,
The below query im using is not working . Does anyone knows what's wrong with the query?
sqlCommand.CommandText =String.Format("SELECT * FROM Customer" +
" WHERE (Name like @Name)","'%" +searchString.Trim()+"%'");
sqlCommand.Parameters.AddWithValue("Name", searchString);
This query isnt fetching the desired records.
I'm getting the following error while running the above snippet:
Must declare the scalar variable "@Name".
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…