|
-
Jan 24th, 2003, 09:22 AM
#1
Thread Starter
Registered User
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..
Last edited by jkw119; Jan 24th, 2003 at 09:42 AM.
-
Jan 24th, 2003, 11:10 AM
#2
If there is no table with those fields then you'd have to first make the table then fill in the proper update query and do what you are doing. Unlike the ReadXML method of a dataset that also adds the structure an actual database can not add the structure of the table on the fly like that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|