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

ASP.Net
1. ADO.net Database
2. Asp Control
3. Collections
4. Components
5. Data Binding
6. Development
7. HTML Control
8. Mobile Control
9. Page
10. Request
11. Response
12. Server
13. Session Cookie
14. User Control and Master Page
15. Validation by Control
16. Validation by Function
17. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
ASP.Net » XML » XML DataSet 
Display column information: dataset from xml file

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

<html>
  <head>
    <title>Display Column Information</title>
  </head>
</html>

<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
  objDataSet.ReadXmlSchema(Server.MapPath("Comments.xsd"))
  objDataSet.ReadXml(Server.MapPath("Comments.xml"))

  ' Diagnostic print of tables in objDataSet - loop through DataSet.Tables
  Dim strNames As String
  Dim 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/>"
    Next

  Next
  Response.Write(strNames)
End Sub
</script>


<%-- Comments.xsd
<?xml version="1.0" standalone="yes"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
  <element name="Reviews">
    <complexType>
      <choice maxOccurs="unbounded">
        <element name="Review">
          <complexType>
            <sequence>
              <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" />
            </sequence>
          </complexType>
        </element>
      </choice>
    </complexType>
  </element>
</schema>

--%>


<%-- Comments.xml
<?xml version="1.0" standalone="yes"?>
<Reviews>
  <Review>
    <ReviewID>1</ReviewID>
    <ProductName>Name</ProductName>
    <EmployeeID>6</EmployeeID>
    <Date>2001-01-01</Date>
    <Comment>
      comment
    </Comment>
  </Review>
</Reviews>
--%>
           
       
Related examples in the same category
1. Modify XML data set
2. Load xml data to DataSet
3. Load XML data into DataSet
w___w___w_.__java___2_s___.c_o_m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.