Hi All,
I having problems with using 'LIKE' in a SQL statement. I'm using a SQL2000 database with C#. The parameters are from a form in a ASP.NET app. I have tried a number of different ways of referencing the parameter but none seem to work. Here is the statement i'm using:
This is the error i'm gettingPHP Code:objCmd = new SqlCommand("SELECT * FROM tbl_employee "+
"WHERE skills LIKE %@skills% " +
"OR industry = @industry ", objConn);
objCmd.Parameters.Add("@skills", txtSkills.Text);
objCmd.Parameters.Add("@industry", ddlIndustry.SelectedItem.Value);
System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '@skills'.
If i hardcode the parameter it works fine. Eg. WHERE skills LIKE 'flash'. I have checked to see that the parameters are returning results (which they are).
Thanks,
Jake


Reply With Quote


Bookmarks