By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,652 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,652 IT Pros & Developers. It's quick & easy.

Dump whole dataset to a new access table

P: n/a
Hi all,
I have an application that needs to import XML files into Database.
This XML file was generated by this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim cmdXML As OleDb.OleDbCommand
Dim DScmdXML As OleDb.OleDbDataAdapter
Dim DSXML As New DataSet()

Dim sqlXML As String = "SELECT * FROM List_Piante"
cmdXML = New OleDb.OleDbCommand(sqlXML, conn)
DScmdXML = New OleDb.OleDbDataAdapter(cmdXML)
DScmdXML.Fill(DSXML, "List_Piante")
DSXML.WriteXml("Piante.xml", XmlWriteMode.WriteSchema)
Dim xmlSW2 As System.IO.StreamWriter = New
System.IO.StreamWriter("c:\Piante.xml")
DSXML.WriteXml(xmlSW2, XmlWriteMode.WriteSchema)
xmlSW2.Flush()
xmlSW2.Close()

End Sub

I need to import this XML file into a NEW created ms-access table, but
i don't know how, and i cannot find any helpful suggestion on google.

Many Thanks
Mar 19 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Well i guess you can do 2 things

1 . really create a database from scratch , you can do this with ADOX (
Com interop in .Net ) as there is no managed libraray availlable wich can do
this

OR

2. Create a empty database , with empty tables in a Access database ( repair
and compress it after doing so in Access ) and now add this as a resource
in your executable so instead of creating a new database , your app simply
copies a empty database from it`s resource and fills this with the data
contained in the XML files ( no need for COM interop , much faster )

I have done option 2 numerous times and can show you an example if you want

Michel

"Marcolino" <ma************@gmail.comschreef in bericht
news:41**********************************@d45g2000 hsc.googlegroups.com...
Hi all,
I have an application that needs to import XML files into Database.
This XML file was generated by this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim cmdXML As OleDb.OleDbCommand
Dim DScmdXML As OleDb.OleDbDataAdapter
Dim DSXML As New DataSet()

Dim sqlXML As String = "SELECT * FROM List_Piante"
cmdXML = New OleDb.OleDbCommand(sqlXML, conn)
DScmdXML = New OleDb.OleDbDataAdapter(cmdXML)
DScmdXML.Fill(DSXML, "List_Piante")
DSXML.WriteXml("Piante.xml", XmlWriteMode.WriteSchema)
Dim xmlSW2 As System.IO.StreamWriter = New
System.IO.StreamWriter("c:\Piante.xml")
DSXML.WriteXml(xmlSW2, XmlWriteMode.WriteSchema)
xmlSW2.Flush()
xmlSW2.Close()

End Sub

I need to import this XML file into a NEW created ms-access table, but
i don't know how, and i cannot find any helpful suggestion on google.

Many Thanks

Mar 23 '08 #2

P: n/a
On 23 Mar, 09:36, "Michel Posseth [MCP]" <M...@posseth.comwrote:
Well i guess you can do 2 things

1 . really create a database from scratch , you can do this with ADOX * (
Com interop in .Net ) as there is no managed libraray availlable wich can do
this

OR

2. Create a empty database , with empty tables in a Access database ( repair
and compress it after doing so in Access ) *and now add this as a resource
in your executable * so instead of creating a new database , your app simply
copies a empty database from it`s resource and fills this with the data
contained in the XML files ( no need for COM interop , much faster )

I have done option 2 numerous times and can show you an example if you want

Michel

"Marcolino" <marco.pozzu...@gmail.comschreef in berichtnews:41**********************************@d 45g2000hsc.googlegroups.com...
Hi all,
I have an application that needs to import XML files into Database.
This XML file was generated by this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
* * * *Dim cmdXML As OleDb.OleDbCommand
* * * *Dim DScmdXML As OleDb.OleDbDataAdapter
* * * *Dim DSXML As New DataSet()
* * * *Dim sqlXML As String = "SELECT * FROM List_Piante"
* * * *cmdXML = New OleDb.OleDbCommand(sqlXML, conn)
* * * *DScmdXML = New OleDb.OleDbDataAdapter(cmdXML)
* * * *DScmdXML.Fill(DSXML, "List_Piante")
* * * *DSXML.WriteXml("Piante.xml", XmlWriteMode.WriteSchema)
* * * *Dim xmlSW2 As System.IO.StreamWriter = New
System.IO.StreamWriter("c:\Piante.xml")
* * * *DSXML.WriteXml(xmlSW2, XmlWriteMode.WriteSchema)
* * * *xmlSW2.Flush()
* * * *xmlSW2.Close()
End Sub
I need to import this XML file into a NEW created ms-access table, but
i don't know how, and i cannot find any helpful suggestion on google.
Many Thanks- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -
MIchel,
very thanks for your help.
can you provide me the example for option 2?

Thanks
Mar 24 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.