T
Tom W
code snipped from MS sample "N-Tier Data Form and Data Layer" example
(101 vb.net samples).
Public Class frmMain
Private dsSupplierProducts as DataSet
Private dtSupplier as DataTable
Private dtProducts as DataTable
Private dvSupplier as DataView
Private dvProduct as DataView
Sub GetDateSet()
m_DAL = new DataAccess () 'Data access tier.
dsSupplierProducts = m_DAL.CreateDataSet() ' this returns one
dataset with two tables, Supplier & Products
'Set variables for the DataTables for use later
dtSupplier = dsSupplierProducts.Tables("Supplier")
dtProducts = dsSupplierProducts.Tables("Products")
'Set up Dataviews for the datagrid
dvSupplier = dtSupplier.DefaultView
dvProduct as dtProducts.DefaultView
end Sub
Sub BindProductsGrid()
....
dvProducts.RowFilter = "Suppliers = " & strCurrentSupplierID
With grdProducts
.CaptionText = "whatever"
.DataSource = dvProducts
end With
End Sub
What I don't understand are the lines
dtSupplier = dsSupplierProducts.Tables("Supplier")
dtProducts = dsSupplierProducts.Tables("Products")
Do these assignments populate separate, distinct datatables with the two
tables from the dataset? IE: the data now exists in two places?
Or are the datatables just pointers to the original dataset.datatables
(dsSupplierProducts.Tables(".."))?
Changes made to data in the grids is passed back to the data access tier
like:
m_DAL = new DataAccess()
m_DAL.UpdateDataSet(dsSuppliersProducts.GetChanges())
Thanks
Tom
--
E-mail correspondence to and from this address may be subject to the
North Carolina Public Records Law and may be disclosed to third parties.
(101 vb.net samples).
Public Class frmMain
Private dsSupplierProducts as DataSet
Private dtSupplier as DataTable
Private dtProducts as DataTable
Private dvSupplier as DataView
Private dvProduct as DataView
Sub GetDateSet()
m_DAL = new DataAccess () 'Data access tier.
dsSupplierProducts = m_DAL.CreateDataSet() ' this returns one
dataset with two tables, Supplier & Products
'Set variables for the DataTables for use later
dtSupplier = dsSupplierProducts.Tables("Supplier")
dtProducts = dsSupplierProducts.Tables("Products")
'Set up Dataviews for the datagrid
dvSupplier = dtSupplier.DefaultView
dvProduct as dtProducts.DefaultView
end Sub
Sub BindProductsGrid()
....
dvProducts.RowFilter = "Suppliers = " & strCurrentSupplierID
With grdProducts
.CaptionText = "whatever"
.DataSource = dvProducts
end With
End Sub
What I don't understand are the lines
dtSupplier = dsSupplierProducts.Tables("Supplier")
dtProducts = dsSupplierProducts.Tables("Products")
Do these assignments populate separate, distinct datatables with the two
tables from the dataset? IE: the data now exists in two places?
Or are the datatables just pointers to the original dataset.datatables
(dsSupplierProducts.Tables(".."))?
Changes made to data in the grids is passed back to the data access tier
like:
m_DAL = new DataAccess()
m_DAL.UpdateDataSet(dsSuppliersProducts.GetChanges())
Thanks
Tom
--
E-mail correspondence to and from this address may be subject to the
North Carolina Public Records Law and may be disclosed to third parties.