给dataset添加多条记录后,再更新数据库,如何实现?急~~请帮忙答一下,谢谢
我想给dataset添加多条记录后,再一次将这几条添加的记录更新到数据库,如何实现啊?
不好意思,问题没说清楚
首先是如何给dataset新增多条记录?我只能增加一条,再增加就覆盖掉原先增加的那一条了~~
还是不行啊~~~dataset11是公用的 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim mydtb As New DataTable Dim mydrow As DataRow ' SqlDataAdapter1.Fill(DataSet11, "moneyDistr") mydrow = DataSet11.Tables("moneyDistr").NewRow() mydrow("pid") = TextBox1.Text mydrow("wid") = ListBox1.Selectedvalue mydrow("dkrq") = TextBox2.Text mydrow("wdk") = txtmd.Text DataSet11.Tables("moneyDistr").Rows.Add(mydrow) DataSet11.AcceptChanges() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If DataSet11.HasChanges Then SqlDataAdapter1.Update(DataSet11, "moneyDistr") End If End Sub button2是对dataset11提交添加的记录,button3是更新数据库 |