TextBox txtStatus = GridView1.Rows[e.RowIndex].FindControl("TextBox6") as TextBox;
string strcn = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
SqlConnection con = new SqlConnection( strcn);
con.Open();
SqlCommand cmd = new SqlCommand("update Associate_Table set [Status] = @Status where [Associate ID] =+Convert.ToInt32(id.Text)", con);
cmd.Parameters.AddWithValue("@Status", txtStatus.Text);
int i = cmd.ExecuteNonQuery();
con.Close();
plz help getting error. I have no idea what, I done here
and the error is System.Data.SqlClient.SqlException: ‘Incorrect syntax near ‘.’.’
2
Answers
Put aout the parameter from the query string…
Something like :
Use the + sign only for concatenating string values. Update your code by following snippet.