These 12 lines of VB.NET code in an ASP.NET file successfully convert a table from an Access database into a DataSet and then write this information about to an XML file and a Schema file. You can see with this example that XML is really at the center of .NET, fantastic!
Sub Page_Load()
Dim strConnect As String
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\edward\Association.mdb"
Dim strSelect As String
strSelect = "SELECT * FROM Members"
Dim objDataSet As New DataSet
Dim objConnect As New OleDbConnection(strConnect)
Dim objDataAdapter As New OleDbDataAdapter(strSelect, objConnect)
objDataAdapter.Fill(objDataSet, "Members")
Dim strVirtualPath As String = Request.ApplicationPath & "/Members.xml"
Dim strVSchemaPath As String = Request.ApplicationPath & "/Members.xsd"
objDataSet.WriteXML(Request.MapPath(strVirtualPath))
objDataSet.WriteXMLSchema(Request.MapPath(strVSchemaPath))
End Sub
0 comments:
Post a Comment