Results 1 to 2 of 2

Thread: XML to Database through ASP

  1. #1

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    XML to Database through ASP

    I'm new to this XML stuff and I want to run a simple project and that is to retreive data from an XML file and place it into and Access database.

    Please help

    I'm sorry if this is not posted in the correct area
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Post

    <% @language=vbscript%>

    <%
    Set objXML = Server.CreateObject("MsXML.DOMDocument")
    objXML.Load ("c:\xmlNames.txt")

    Dim nNames
    Dim eName
    Dim iCount


    Set oConn = CreateObject("Adodb.Connection")

    Set oRs = CreateObject("Adodb.Recordset")

    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\abhijit\xmlDB.mdb;Persist Security Info=True"
    oRs.Open "Select * From Celebs", oConn, 3, 3

    Set nNames = objXML.selectNodes("//NAME")

    For iCount = 0 To nNames.length - 1
    Set eName = nNames.Item(iCount)
    oRs.AddNew
    oRs.Fields("sFirstName") = eName.getAttribute("Value")
    oRs.Update
    Next

    %>

    The XML Message is as follows.
    <NAMES>
    <NAME Value="John Lennon"/>
    <NAME Value="Madonna"/>
    <NAME Value="Ronan Keating"/>
    <NAME Value="Geri Halliwell"/>
    </NAMES>

    You will need to put it in the text file.

    -Abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

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