3
Reply

System.Data.SqlClient.SqlException:Incorrect syntax near '='

Ask a question
abhilash bc

abhilash bc

8 years ago
295
1
my code is
 
SqlConnection con = new SqlConnection(clsutilities.STRCONN);
con.Open();
string query = "SELECT Rating FROM UserRating3 where pid=" + @pid;
SqlCommand cmd = new SqlCommand(query, con);
//SqlCommand cmd = new SqlCommand("SELECT Rating FROM UserRating1 ",con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
 

Answers (3)