asp.net.ph

DataSet.Tables Property

System.Data Namespace   DataSet Class


Returns the collection of tables contained in the DataSet.

Syntax


Script [ DataTableCollection variable = ] DataSet.Tables

Property Value


variable The DataTableCollection contained by this DataSet; otherwise a null value if no DataTable objects exist.

The property is read only with no default value.

Remarks

To add tables to the collection, use Add method of the DataTableCollection. To remove tables, use the Remove method.

Example

The following example returns the DataSet object's DataTableCollection, and prints the columns and rows in each table.

private void PrintRows ( DataSet myDataSet ) {
   // for each table in the DataSet, print the row values.
   foreach ( DataTable myTable in myDataSet.Tables ) {
      foreach ( DataRow myRow in myTable.Rows ) {
         foreach ( DataColumn myColumn in myTable.Columns ) {
            Response.Write ( myRow [ myColumn ] );
        }
     }
   }
}
  C# VB

See Also

DataSet Members   DataTable   DataTableCollection Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph