<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.OleDb"%>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim objConn As New OleDbConnection
Dim objCmd As New OleDbCommand
Dim dtAdapter As New OleDbDataAdapter
Dim ds As New DataSet
Dim strConnString,strSQL As String
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("database/mydatabase.mdb")&";"
strSQL = "SELECT * FROM customer"
objConn.ConnectionString = strConnString
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd
dtAdapter.Fill(ds)
dtAdapter = Nothing
objConn.Close()
objConn = Nothing
'*** Export XML ***'
ds.Tables(0).WriteXML(Server.MapPath("XML/myXml.xml"))
'ds.Tables(0).WriteXmlSchema(Server.MapPath("XML/myXml.xml"))
ds = Nothing
Me.lblText.Text = "XML Created <a href=XML/myXml.xml>click here</a> to view"
End Sub
</script>
<html>
<head>
<title>ThaiCreate.Com ASP.NET - XML</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label id="lblText" runat="server"></asp:Label>
</form>
</body>
</html>