i am trying to update gridview row but m getting error:-----Conversion failed when converting the varchar value 'vadodra' to data type int.
my code is
protected void Button1_Click(object sender, EventArgs e)
{
if (Button1.Text == "Submit")
{
myobj.myconnection();
SqlCommand sqlcmd = new SqlCommand("Insert into regional(Regional, stateid) values ('" + TextBox1.Text + "','" + DropDownList1.SelectedItem.Value + "')", myobj.sqlcon);
sqlcmd.ExecuteNonQuery();
fillgrid();
TextBox1.Text = "";
DropDownList1.ClearSelection();
}
else if(Button1.Text == "update")
{
myobj.myconnection();
SqlCommand cmd = new SqlCommand("UPDATE regional SET Regional='" + DropDownList1.SelectedItem.Value + "', stateid='"+TextBox1.Text+"' where ID='" + GridView1.SelectedValue.ToString() + "'", myobj.sqlcon);
cmd.ExecuteNonQuery();
fillgrid();
}
}