C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » XML »

Database values into to XML file


Posted Date: 01 Mar 2009    Resource Type: Code Snippets    Category: XML
Author: Deepika HaridasMember Level: Diamond    
Rating: 1 out of 5Points: 10



Populate your database values into XML file by passing database name through textbox. The following sample code demonstrates how to populate the database values into XML file.


Private Sub cmdMakeXmlFile_Click()
Dim db_name As String
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim dom_document As DOMDocument

' Get the database's name.
db_name = txtDatabase.Text

' Open the connection.
Set conn = New ADODB.Connection
conn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & _
"Data Source=" & db_name
conn.Open

' Open the Recordset.
Set rs = conn.Execute("SELECT * FROM Books ORDER BY " & _
"Title")

' Save the data into a DOMDocument.
Set dom_document = New DOMDocument
rs.Save dom_document, adPersistXML

rs.Close
conn.Close

' Save the XML data into an XML file.
db_name = Replace$(db_name, ".mdb", ".xml")
dom_document.Save db_name
MsgBox "Now move the XML file to a HTTP site."
End Sub



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Xml  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Populate a Dataset with an XML file
Previous Resource: How to use Style and Setter in XAML
Return to Discussion Resource Index
Post New Resource
Category: XML


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use