A
Agnes
I got a Master-Detail relationship. Branch with dept (two tables) , as the
user input the Dept code, press 'Confirm' button,
I will select * from branch and input into the datatable mannually. the
dgBranchDept.datasource = myDataset. datamember= foreginconstraint_deptid.
I found the datatable got the data, but the datagrid display nothing. I
check the post before and try all the method. but still fail . please help
Here the following is my coding :---
drBranch = cmdBranch.ExecuteReader
dtSysBranchDept.BeginInit()
dgBranchDept.EndInit()
bmSysBranchDept.EndCurrentEdit()
Do While drBranch.Read
myDataRow = dtSysBranchDept.NewRow()
myDataRow.BeginEdit()
myDataRow.Item("branchid") = drBranch.Item("branchid")
myDataRow.item("deptid") = txtDeptId.Text
'MessageBox.Show(drBranch.Item("branchid")) <--- work fine
dtSysBranchDept.Rows.Add(myDataRow)
myDataRow.EndEdit()
Loop
drBranch.Close()
dtSysBranchDept.AcceptChanges()
Me.bmSysBranchDept.EndCurrentEdit()
dtSysBranchDept.EndInit()
user input the Dept code, press 'Confirm' button,
I will select * from branch and input into the datatable mannually. the
dgBranchDept.datasource = myDataset. datamember= foreginconstraint_deptid.
I found the datatable got the data, but the datagrid display nothing. I
check the post before and try all the method. but still fail . please help
Here the following is my coding :---
drBranch = cmdBranch.ExecuteReader
dtSysBranchDept.BeginInit()
dgBranchDept.EndInit()
bmSysBranchDept.EndCurrentEdit()
Do While drBranch.Read
myDataRow = dtSysBranchDept.NewRow()
myDataRow.BeginEdit()
myDataRow.Item("branchid") = drBranch.Item("branchid")
myDataRow.item("deptid") = txtDeptId.Text
'MessageBox.Show(drBranch.Item("branchid")) <--- work fine
dtSysBranchDept.Rows.Add(myDataRow)
myDataRow.EndEdit()
Loop
drBranch.Close()
dtSysBranchDept.AcceptChanges()
Me.bmSysBranchDept.EndCurrentEdit()
dtSysBranchDept.EndInit()