PC Review


Reply
Thread Tools Rate Thread

Convert MS Access data to XML programmatically

 
 
Thu
Guest
Posts: n/a
 
      31st Aug 2003
I store me reporting data in MS Access table, and I need
to programmatically generate XML file (in text) that
loads these data, include all these data with appropriate
definition, i.e. root, elements, entities, and sends
these data to another party on daily basis.

Does anyone know the easiest way to achieve this? Is
there a class that loads data from MS Access, match them
with definition files, and generate XML text file
automatically?

Thanks.
 
Reply With Quote
 
 
 
 
Ken Tucker
Guest
Posts: n/a
 
      31st Aug 2003
Hi,

Load the data in a dataset. Use the dataset.writexml method to save
it as xml.
Dim da As OleDbDataAdapter

Dim conn As OleDbConnection

Dim ds As New DataSet

conn = New OleDbConnection("Provider = Microsoft.JET.OleDB.4.0; Data Source
= USCG.mdb")

da = New OleDbDataAdapter("Select * from Rules", conn)

da.Fill(ds)

ds.WriteXml("C:\Rules.xml")

Ken

-----------------

"Thu" <(E-Mail Removed)> wrote in message
news:025401c36fb5$05767980$(E-Mail Removed)...
> I store me reporting data in MS Access table, and I need
> to programmatically generate XML file (in text) that
> loads these data, include all these data with appropriate
> definition, i.e. root, elements, entities, and sends
> these data to another party on daily basis.
>
> Does anyone know the easiest way to achieve this? Is
> there a class that loads data from MS Access, match them
> with definition files, and generate XML text file
> automatically?
>
> Thanks.



 
Reply With Quote
 
One Handed Man
Guest
Posts: n/a
 
      31st Aug 2003
you need to use the oledbconnection, dataadapter and generate a dataset from
them. Us the writexml method of the dataset to write the data to the
currently set iostream

HTH

Private Sub WriteXmlToFile(thisDataSet As DataSet)
If thisDataSet Is Nothing Then
Return
End If
' Create a file name to write to.
Dim filename As String = "myXmlDoc.xml"
' Create the FileStream to write with.
Dim myFileStream As New System.IO.FileStream _
(filename, System.IO.FileMode.Create)
' Create an XmlTextWriter with the fileStream.
Dim myXmlWriter As New System.Xml.XmlTextWriter _
(myFileStream, System.Text.Encoding.Unicode)
' Write to the file with the WriteXml method.
thisDataSet.WriteXml(myXmlWriter)
myXmlWriter.Close()
End Sub


--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.


"Thu" <(E-Mail Removed)> wrote in message
news:025401c36fb5$05767980$(E-Mail Removed)...
> I store me reporting data in MS Access table, and I need
> to programmatically generate XML file (in text) that
> loads these data, include all these data with appropriate
> definition, i.e. root, elements, entities, and sends
> these data to another party on daily basis.
>
> Does anyone know the easiest way to achieve this? Is
> there a class that loads data from MS Access, match them
> with definition files, and generate XML text file
> automatically?
>
> Thanks.



 
Reply With Quote
 
 
 
Reply

« SaveAs | Excel »
Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically convert Access mdb to SQL 2005 Database Piggy Microsoft VB .NET 6 24th Apr 2009 07:22 AM
How to convert an access database programmatically using C#? Jon S via DotNetMonster.com Microsoft C# .NET 2 28th Nov 2005 02:20 PM
Programmatically convert Access database Ron Hinds Microsoft Access 7 24th Jun 2005 04:37 AM
Re: Programmatically convert Access 2000 to Access 97 - Can it be done? Ron Hinds Microsoft Access VBA Modules 0 31st Jul 2003 07:00 PM
Re: Programmatically convert Access 2000 to Access 97 - Can it be done? Ron Hinds Microsoft Access VBA Modules 0 31st Jul 2003 06:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:05 AM.