Results 1 to 2 of 2

Thread: Help saving XML table to a database

Threaded View

  1. #1

    Thread Starter
    Registered User jkw119's Avatar
    Join Date
    Oct 2001
    Location
    Pittsburgh
    Posts
    256

    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:
    1. Imports System
    2. Imports System.Data
    3. Imports System.Diagnostics
    4. Imports eInfoDesigns.dbProvider.MySqlClient
    5.  
    6. Sub Main()
    7.  
    8. Dim DataSource As String = "mliwebsvr"
    9. Dim Database As String = "test"
    10. Dim UserID As String = "UserID"
    11. Dim Password As String = "Password"
    12.  
    13. '  The connection, with command loggin on.  Connection pooling is
    14. '  activated by default, but can be turned off by adding
    15. '  the POOLING=false flag.
    16.  
    17.  Dim dbConnection As New MySqlConnection("Data Source=" + DataSource + _
    18. ";Database=" + Database + ";" + "User ID=" + UserID + ";Password=" _
    19.  + Password + ";COMMAND LOGGING=false")
    20. dbConnection.Open()
    21.  
    22. Dim AdapterCommand As New MySqlCommand()
    23. Dim Adapter As New MySqlDataAdapter()
    24.  
    25. AdapterCommand.Connection = dbConnection
    26. Adapter.SelectCommand = AdapterCommand
    27.  
    28. Dim BeamData As New DataSet()
    29. BeamData.ReadXml("a5_optimum_1.xml")
    30.  
    31. Adapter.InsertCommand.Parameters.Add(BeamData.Tables(0))
    32.  
    33. Adapter.Fill(BeamData)
    34. Adapter.Update(BeamData)
    35.  
    36. dbConnection.Close()
    37. 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width