我用了dataview和两个datagrid,datagrid1显示dataset中所有的记录,datagrid2显示删除的记录,dataview提供datagrid2的数据,dataview.RowStateFilter = DataViewRowState.deleted,如果datagrid1的数据删除后,就会显示在datagrid2中,但是我删除datagrid1中记录后,datagrid2的记录还是为空:
我用的代码:
Private Sub customer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dim ds as new dataset
Dim cnnstr, str As String
cnnstr = "Provider = microsoft.jet.oledb.4.0;data source=" & Application.StartupPath & "\library.mdb"
str = "select * from keep"
Dim da As New OleDb.OleDbDataAdapter(str, cnnstr)
da.Fill(ds, "keep")
DataGrid1.DataSource = ds.Tables("keep")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dim dv as new dataview
dv.Table = ds.Tables("keep")
dv.RowStateFilter = DataViewRowState.deleted
DataGrid2.DataSource = dv
ds.Tables("keep").Rows.removeat(1)
End Sub
请问错在哪了,怎么做才可以了?
小弟先谢了!
关于dataview.RowStateFilter对dataset过滤的问题