traversing strongly typed DataSet - 06-09-2004 , 11:51 AM
The latest in a string of messages dealing with Strongly Typed DataSets.
I've got a Strongly Typed DataSet 'filled', but I cannot seem to figure out
how to traverse it.
My typed DataSet is called 'RPDCY_TDataSet'. It has three columns: TAG,
SRC_TAG, DST_TAG. The class was generated with xsd.exe from an XML Schema
file (scraped from a database table):
RPDCY_TDataSet dsData = new RPDCY_TDataSet();
int nRows = daNew.Fill( dsData, "DATA" ); // daNew is an
OleDbDataAdapter. nRows = 55
foreach ( DataTable tbl in dsData.Tables )
DiagnosticLog.Debug( tbl.TableName ); // prints RPDCY_T and DATA
DiagnosticLog.Debug( "# rows = " + dsData.Tables[
"DATA" ].Rows.Count.ToString() ); // prints 55 rows
DiagnosticLog.Debug( "# rows = " + dsData.RPDCY_T.Rows.Count.ToString() );
// prints 0 rows, not expected
foreach ( RPDCY_TDataSet.RPDCY_TRow row in dsData.RPDCY_T.Rows ) //
doesn't execute anything - no rows
DiagnosticLog.Debug( row.TAG.ToString() + " " + row.SRC_TAG.ToString() +
" " + row.DST_TAG.ToString() );
So am I doing something wrong when referencing my Rows of my types DataSet
Thanks for any advice!
Re: traversing strongly typed DataSet - 06-09-2004 , 12:52 PM
"Corey Wirun" <corey.wirun (AT) nospam (DOT) ca> wrote
DataAdapter.Fill created a new table instead of filling the existing one.
This is an annoying "feature" of datasets, it's really easy to add a new
table using a DataAdapter. For typed datasets you almost never want to do
daNew.Fill( dsData, "RPDCY_T" );
daNew.Fill( dsData, dsData.RPDCY_T.Rows);
Re: traversing strongly typed DataSet - 06-09-2004 , 01:21 PM
Once more, the Grasshopper is humbled by the Master.
"David Browne" <davidbaxterbrowne no potted meat (AT) hotmail (DOT) com> wrote in
message news:e3FVxIkTEHA.3480 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
|Thread Tools||Search this Thread|