We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

“Storing an XML file in a Database and Retrieving an Xml file from a Database”

Thread ID:

Created:

Updated:

Platform:

Replies:

58883 Mar 30,2007 12:46 AM Apr 3,2007 08:47 AM Windows Forms 1
loading
Tags: FAQ
Nandkishore Ohatker
Asked On March 30, 2007 12:46 AM

Hi,
Kindly assume that I have a file called demo.xml which is in the following path “d:\nandu\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

Deepak Chaudhary
Replied On April 3, 2007 08:47 AM

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:\nandu\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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;