This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Friday, May 16, 2008

Convert database tables into XML and Schema in 12 lines

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:

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger