string settings = Convert.ToString(ConfigurationManager.ConnectionStrings["SqlServices"]);
SqlConnection myconn = new SqlConnection(settings);
myconn.Open();
string sql = "delete from qygl_kqgl Where ID=" + Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
SqlCommand mycmd = new SqlCommand(sql, myconn);
mycmd.ExecuteNonQuery();
myconn.Close();
我是点GridView1 中的“删除”才报错的