我想通过两个DataGrid显示订单信息(DataGrid1)和订单分录信息(DataGrid2),。按照我下面的代码可以完成界面的加载,但是当我想单击DataGrid1里面的第二条订单的时候,Datagrid2里面就不能显示订单分录信息了。我不知道怎样能捕捉到Datagrid1的当前记录的字段值。或者能否直接关联?请大侠指点!
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Dim Dtl_SO As DataSet = New DataSet5
Dim adoRS As ADODB.Recordset = New ADODB.Recordset
Dim adors_SE As ADODB.Recordset = New ADODB.Recordset
Dim Fid As Integer
adoRS.Open("select * from Seord1 where [cusname]='" & Me.TreeView1.SelectedNode.Text & "'", Cnn1, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
Fid = adoRS.Fields(0).Value
adors_SE.Open("select * from Seordentry1 where [finterid]=" & Fid, Cnn1, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
Me.OleDbDataAdapter1.Fill(Me.DataSet51.Seord1, adoRS)
Me.OleDbDataAdapter2.Fill(Me.DataSet51.SeordEntry1, adors_SE)
DataGrid1.DataSource = Dtl_SO
DataGrid1.SetDataBinding(Me.DataSet51, "Seord1")
DataGrid2.DataSource = Dtl_SO
DataGrid2.SetDataBinding(Me.DataSet51, "Seord1.SeordEntry_R")
End Sub