protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
try
{
string constr = @"Data Source=SQLEXPRESS2008;Initial Catalog=Database;Integrated Security=True";
string query = "DELETE FROM Table_Name WHERE 1st_column=@a";
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand();
cmd.Parameters.Add("@a", SqlDbType.Int).Value = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[1].Text)";
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
BindData();
}
catch(Exception ex)
{
throw ex;
}
}