Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2005

    Unanswered: ADO save Recordset XML HELP!


    I have a sample ASP script that will open an Access db, run a SQL query, and use the save feature of the ADODB recordset to the response buffer (to display it on screen):

    oRS.Save Response, adPersistXML

    This is the standard way I have seen on most ADO Save examples.

    I made this script at work, and it functions as expected. An example of the results from the script:
    <schema id="RowsetSchema">
    <s:ElementType name="row" content="eltOnly">
    <s:AttributeType name="ID" rs:number="1" rs:maydefer="true" rs:writeunknown="true">
    <s:datatype dt:type="int" dt:maxLength="4" rsrecision="10" rs:fixedlength="true"/>
    <s:AttributeType name="price_group_ID" rs:number="2" rs:nullable="true" rs:maydefer="true" rs:writeunknown="true">
    <s:datatype dt:type="int" dt:maxLength="4" rsrecision="10" rs:fixedlength="true"/>

    Great stuff. However, I took the script home, and tried to run it on my XP PRO, and got an error. I loaded the script onto a hosting companies webserver, and got the same error. I loaded the script onto a 2nd and 3rd webserver, and got the same error.

    The error is :

    XML Parsing Error: not well-formed
    TG! (with some squares before the TG)

    When I view the source (Only works in Firefox, IE says no source) I get:
    TG!???????#?_Xtc??????????@??????\?????Dw=?I?<???? _?X!?ID
    etc etc etc.

    Now this is the same script, using the same database. It works on
    1) my work server. Windows 2000 server.

    It doesnt work on

    1) XP PRO SP2, IIS 5.1

    2) Windows 2000 server (hosting company 1)

    3) Windows 2000 server (hosting company 2)

    4) Windows 2003 server (Hosting compoany 3)

    Can anyone help shed some light on this? I am running lates version of MDAC at home, and all service patches. I ran MS Component checker, and it says all is installed ok. Below is the code.

    Why does it work at work but on no other server? All the examples on the web show the Save method working fine, and am stumped. I have googled but cant find anything.

    Please can anyone help?

    dim objConn
    dim oRS
    dim connStr, sSQL
    sSQL = "select * from _storePriceGroupsMatrix"
    connStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & Server.MapPath("webData.mdb")


    Set objConn = Server.CreateObject("ADODB.Connection")
    Set oRS = Server.CreateObject("ADODB.Recordset") connStr

    Set oRS.ActiveConnection = objConn
    oRS.Open sSQL
    oRS.Save Response, adPersistXML

    If oRS.STATE = adStateOpen Then oRS.Close
    If objConn.STATE = adStateOpen Then objConn.Close
    Set oRS = Nothing
    Set objConn = Nothing %>

  2. #2
    Join Date
    Nov 2005

    more strange ado output

    Error Code: -1072896760
    Error Reason: An invalid character was found in text content.
    Error Line: 1
    Browser ASP Response buffer ERROR
    XML Parsing Error: not well-formed
    Location: http://localhost/ado/defaultserver.asp
    Line Number 1, Column 1:TG!

    So I am guessing that the ADODB.Recordset object isnt writing XML?

    I changed the save option from AdPersistXML to ADPersistATDG (The only 2 options). The output is the same for both., both 5.77 KB (5,911 bytes), and give the same error message in the browser.

    I saved each recordset to file. When I tried to load either file saved (ADPersistATDG or ADPersistXML), the script stops at the line loading the file (even with ON ERROR RESUME NEXT)

    I tried the same using ADODB.Stream's, with asp example code from MSDN. When I save a stream to the response buffer, or file, I get exactly the same result as saving a Recordset. Same file, same contents.

    I have also tried this with the Northwind Access database (downloaded from Microsoft), in case my db was corrupt. Same results. Tried with Access 98 and 2000 db's too.

    So on 4 seperate servers (different MS OS's, locations) I am getting the same results.

    But on my work server, it works fine.

    OK either something is wrong with my implementation of the ADODB object Save method (my scripts are from MSDN, and work on 1 server).

    Or something is up with the ADODB Save Method on these 4 servers? Maybe out of date MDAC?
    I downloaded MDAC and Microsoft Jet Analysis and Repair Utility, and have the latest Jet and MDAC libraries installed. (ADO is part of MDAC)

    Does anyone know why I always get the same output from the Save method, whatever I try? Its got to be something silly. Could you please try my original ASP code example and tell me what your ADODB outputs to the browser window?

    Edit/Delete Message

  3. #3
    Join Date
    Nov 2003
    Christchurch, New Zealand
    Sounds to me like something in the database records you are querying has an invalid XML character that can't be handled correctly by MDAC/MSXML Parser.

    Have you actually check the data that you are getting back from the database to make sure it is the same from you 2k system as it is from the XP system?

    As well as making sure that your MDAC version is up to date have you checked your MSXML parsers??

    If it is the loading that is the problem (which it sounds like) can you attach a copy of the xml that is generated that is causing the problem so we can see where the error might be?

Posting Permissions

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