Results 1 to 13 of 13

Thread: [RESOLVED] [2005] readXML populate different Tables

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2006
    Posts
    426

    Resolved [RESOLVED] [2005] readXML populate different Tables

    Ok. I Export two tables in XML using writeXML and i want to update another database with the same table schema with these XML tables.
    Below is the Update code and Exported XML i am trying to use.
    So far No Luck. where am i going wrong?
    Code:
    VB Code:
    1. Private Sub updateFromXML()
    2.         Dim dsXMLImport As New DataSet
    3.         Dim cmdAdapter As New OleDbCommand
    4.         myConn = New OleDbConnection(strAccessConn)
    5.  
    6.         Try
    7.             myConn.Open()
    8.             cmdAdapter.Connection = myConn
    9.             Dim da1 As New OleDbDataAdapter()
    10.             Dim da2 As New OleDbDataAdapter()
    11.  
    12.             dsXMLImport.ReadXml(Me.tbFilePath.Text)
    13.             'For Table 1
    14.             da1.SelectCommand = cmdAdapter
    15.             da1.InsertCommand.Parameters.Add(dsXMLImport.Tables(0))
    16.             da1.Fill(dsXMLImport)
    17.             da1.Update(dsXMLImport)
    18.             'For Table 2
    19.             da2.SelectCommand = cmdAdapter
    20.             da2.InsertCommand.Parameters.Add(dsXMLImport.Tables(1))
    21.             da2.Fill(dsXMLImport)
    22.             da2.Update(dsXMLImport)
    23.  
    24.         Catch ex As Exception
    25.  
    26.         Finally
    27.             myConn.Close()
    28.             cmdAdapter.Dispose()
    29.         End Try
    30.     End Sub
    Attached Files Attached Files

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