I can't find out why I'm getting this error:
System.Data.SqlClient.SqlException: 'Incorrect syntax near 'Judgment'.'
Code:
protected void gvComic_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int ID = Convert.ToInt32(gvComic.DataKeys[e.RowIndex].Value.ToString());
string Name = ((TextBox)(gvComic.Rows[e.RowIndex].Cells[1].Controls[0])).Text;
string UnitPrice = ((TextBox)(gvComic.Rows[e.RowIndex].Cells[2].Controls[0])).Text;
string PublishCountry = ((TextBox)(gvComic.Rows[e.RowIndex].Cells[3].Controls[0])).Text;
string Author = ((TextBox)(gvComic.Rows[e.RowIndex].Cells[4].Controls[0])).Text;
string Description = ((TextBox)(gvComic.Rows[e.RowIndex].Cells[5].Controls[0])).Text;
string Translator = ((TextBox)(gvComic.Rows[e.RowIndex].Cells[6].Controls[0])).Text;
string CoverPage = ((TextBox)(gvComic.Rows[e.RowIndex].Cells[7].Controls[0])).Text;
using (SqlConnection conn = new SqlConnection(cs))
{
conn.Open();
SqlCommand cmd = new SqlCommand("UPDATE Comics SET Name='" + Name + "', UnitPrice='" + UnitPrice + "', PublishCountry='" + PublishCountry + "', Author='" + Author + "', Description='" + Description + "', Translator='" + Translator + "',CoverFile='" + CoverPage + "' WHERE CId='" + ID + "'", conn);
int t = cmd.ExecuteNonQuery();
if (t > 0 )
{
Response.Write("<script>alert('Data has updated!')</script>");
gvComic.EditIndex = -1;
BindGrind();
}
}
}