Help saving XML table to a database
If anyone has any Ideas, I would greatly appreciate any help, tutorials or anything. All i seem to find is saving a table from the database to xml, but nothing on doing the opposite.
I have the following code...
VB Code:
Imports System
Imports System.Data
Imports System.Diagnostics
Imports eInfoDesigns.dbProvider.MySqlClient
Sub Main()
Dim DataSource As String = "mliwebsvr"
Dim Database As String = "test"
Dim UserID As String = "UserID"
Dim Password As String = "Password"
' The connection, with command loggin on. Connection pooling is
' activated by default, but can be turned off by adding
' the POOLING=false flag.
Dim dbConnection As New MySqlConnection("Data Source=" + DataSource + _
";Database=" + Database + ";" + "User ID=" + UserID + ";Password=" _
+ Password + ";COMMAND LOGGING=false")
dbConnection.Open()
Dim AdapterCommand As New MySqlCommand()
Dim Adapter As New MySqlDataAdapter()
AdapterCommand.Connection = dbConnection
Adapter.SelectCommand = AdapterCommand
Dim BeamData As New DataSet()
BeamData.ReadXml("a5_optimum_1.xml")
Adapter.InsertCommand.Parameters.Add(BeamData.Tables(0))
Adapter.Fill(BeamData)
Adapter.Update(BeamData)
dbConnection.Close()
End Sub
The question I have is, is it possible to do what i am doing? All i need to do is simply write the XML file to the Database, by putting it in a new table. When you use the readxml command, the file is put in the default Table named (Table(0)). How can i then save this to the database. If anyone can help me out, I would greatly appreciate it.
Thank you..