Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default ADO, XML and ASP

    Hi
    I am trying to get the XML out of my Microsoft Access database, I am
    able to get the records from the database however not in the XML format.
    below is the ASP code for the same. What could be the problem.

    <%@ language=JScript %>
    <%
    Response.ContentType = "text/xml"

    var lobjXMLData = Server.CreateObject("Microsoft.XMLDOM")
    lobjXMLData.async = false

    var pobjRecordset = Server.CreateObject("ADODB.Recordset");
    var sSQL , sConn;

    sSQL = "SELECT * FROM Employee"
    sConn= "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\\SRR\\SRR.mdb"

    pobjRecordset.Open(sSQL, sConn);

    // This commented code works.
    /* pobjRecordset.MoveFirst();
    while (pobjRecordset.EOF != true)
    {
    Response.Write(pobjRecordset("EmpId")+pobjRecordse t("Name")+"<br>");
    pobjRecordset.MoveNext();
    }
    */

    Response.Write("<?xml version='1.0' encoding='windows-1252' ?>")

    pobjRecordset.save(lobjXMLData, pobjRecordset.adPersistXML)

    Response.Write(lobjXMLData.xml);
    Response.Write(lobjXMLData.hasChildNodes);
    %>

    The output that comes is "False"


    Regards
    Harvinder Singh


    harvinder singh Guest

  2. #2

    Default Re: ADO, XML and ASP

    harvinder singh wrote:
    > Response.Write("<?xml version='1.0' encoding='windows-1252' ?>")
    This will not work. The Save method will only use utf-8. This will be
    ignored.
    >
    > pobjRecordset.save(lobjXMLData, pobjRecordset.adPersistXML)
    Where did you get this syntax? "adPersistXML" is a constant defined in the
    ADO Type Library. It is not a property of the recordset object.

    I assume you are trying to transfer a recordset to the client, Here is a
    demo showing how to do it:
    [url]http://www.davidpenton.com/testsite/tips/[/url]

    Hmm, I just tested the link and got a "server not found" message. I've
    notified the site's owner.

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows [MVP] Guest

  3. #3

    Default Re: ADO, XML and ASP

    Thanks bob,
    I have changed the code ...
    Removed the "Response.Write("<?xml version='1.0' encoding='windows-1252'
    ?>")"

    and also using 1 instead of "pobjRecordset.adPersistXML"
    i.e. pobjRecordset.save(lobjXMLData, 1)
    but surpriseingly it was not giving me any error


    thanks
    harvinder

    "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
    news:eP8TswnOEHA.268@TK2MSFTNGP11.phx.gbl...
    > harvinder singh wrote:
    >
    > > Response.Write("<?xml version='1.0' encoding='windows-1252' ?>")
    >
    > This will not work. The Save method will only use utf-8. This will be
    > ignored.
    >
    > >
    > > pobjRecordset.save(lobjXMLData, pobjRecordset.adPersistXML)
    >
    > Where did you get this syntax? "adPersistXML" is a constant defined in the
    > ADO Type Library. It is not a property of the recordset object.
    >
    > I assume you are trying to transfer a recordset to the client, Here is a
    > demo showing how to do it:
    > [url]http://www.davidpenton.com/testsite/tips/[/url]
    >
    > Hmm, I just tested the link and got a "server not found" message. I've
    > notified the site's owner.
    >
    > Bob Barrows
    >
    > --
    > Microsoft MVP - ASP/ASP.NET
    > Please reply to the newsgroup. This email account is my spam trap so I
    > don't check it very often. If you must reply off-line, then remove the
    > "NO SPAM"
    >
    >

    harvinder singh Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139