Display column information: dataset from xml file : XML DataSet « XML « ASP.Net

Display column information: dataset from xml file

<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.SqlClient" %>

    <title>Display Column Information</title>

<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)

  ' Create dataset and data adapter with properties that apply to all tables
  Dim objDataSet As New DataSet("EmployeePage")

  ' First Table - "Comments Table" From XML

  ' Diagnostic print of tables in objDataSet - loop through DataSet.Tables
  Dim strNames As String
  Dim c As DataColumn
  Dim iTableItem As DataTable
  For Each iTableItem In objdataSet.Tables
    strNames &= "Table Name: " & iTableItem.tableName & "<br/>"

    For Each c In iTableItem.Columns
      strNames &= "- Column " & c.ColumnName & " is of type " _
                              & c.DataType.ToString & "<br/>"

End Sub

<%-- Comments.xsd
<?xml version="1.0" standalone="yes"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
  <element name="Reviews">
      <choice maxOccurs="unbounded">
        <element name="Review">
              <element name="ReviewID"    type="int" />
              <element name="ProductName" type="string" />
              <element name="EmployeeID"  type="int" />
              <element name="Date"        type="date" />
              <element name="Comment"     type="string" />


<%-- Comments.xml
<?xml version="1.0" standalone="yes"?>

Related examples in the same category

1.Modify XML data set
2.Load xml data to DataSet
3.Load XML data into DataSet