string connectionstring = "Data Source=CE5BC36663C4490\\SQLEXPRESS;Initial Catalog=sql;Integrated Security=True"; SqlConnection conn = new SqlConnection(connectionstring); string str = "select * from dept"; //SqlCommand cmd = new SqlCommand(str,conn ); SqlDataAdapter da = new SqlDataAdapter(); da.TableMappings.Add("Table","dept"); da.SelectCommand = new SqlCommand(str, conn); DataTable dt = new DataTable ("dept"); da.Fill(dt ); dt.AcceptChanges(); dt.Rows [1].Delete (); //dt.RejectChanges(); //da.Update(dt); dt.AcceptChanges(); GridView1.DataSource = dt; GridView1.DataBind();这样做 只是内存 删除,数据库中的数据仍然存在!如何给数据库发请求删除第一行呢
2 回答
- 2 回答
- 0 关注
- 513 浏览
添加回答
举报
0/150
提交
取消