Public Sub insertxml(ByVal m_file As String)
Dim m As String 'XMLFile path
Dim ds As New DataSet
Dim dr As DataRow
Dim dt As New DataTable
Dim i As Integer
Dim dr As DataRow
m = m_file + ".xml"
Dim xm As New XmlTextReader(m_file + ".xml")
ds.ReadXml(xm, XmlReadMode.Auto)
dt = ds.Tables(0)
For Each dr In dt.Rows
Dim strcmd As String
strcmd = "insert into
(col1,col2,col3,clo4)values(" & (dr(0)) & "," & dr(1)) & "," & (dr(2)) & "," & (dr(3)) & ")"
Try
conn.Close()
conn.Open()
cmd = New OleDb.OleDbCommand(strcmd, conn)
cmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox("ex.tostring()")
Exit Sub
Finally
conn.Close()
cmd = Nothing
End Try
Next
MsgBox("Record inserted Successfully", MsgBoxStyle.Information, "Information Message")
End Sub
Use the following sub
Hope it will help you
>Hi,
Kindly assume that I have a file called demo.xml which is in the following path “d:andu\demo.xml” on my machine, tell me how to go about storing this file in database(either Oracle or Sql Server) and retrieving it from the same I am even sending you the sample xml file which I want to store in the database
Thanks,
Nand Kishore
9884706577
demo13.zip