Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XML and ADO (VB)

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 3/30/2009 2:58:00 PM
Juan wrote:
> Line 37 contains: 
> 
> objRS.Open strSTVDBFile,  strSTVConn, adOpenForwardOnly,adLockReadOnly
> 
> 
> I want to use ADO because I try to write an ASP page and because I'm 
> familiar with ADO. 
> 
> I've tried to create a file when it does not exists, but it still fails.

I don't think ADO allows you to parse and manipulate arbitrary XML 
documents. Instead it expects its XML in a certain format. Here is an 
example file:

<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:z="#RowsetSchema">
   <s:Schema id="RowsetSchema">
     <s:ElementType name="row" content="eltOnly" rs:updatable="true">
       <s:AttributeType name="ShipperID" rs:number="1"
         rs:basetable="shippers" rs:basecolumn="ShipperID"
         rs:keycolumn="true">
         <s:datatype dt:type="int" dt:maxLength="4" rs:precision="10"
           rs:fixedlength="true" rs:maybenull="false"/>
       </s:AttributeType>
       <s:AttributeType name="CompanyName" rs:number="2"
         rs:nullable="true" rs:write="true" rs:basetable="shippers"
         rs:basecolumn="CompanyName">
         <s:datatype dt:type="string" dt:maxLength="40" />
       </s:AttributeType>
       <s:AttributeType name="Phone" rs:number="3" rs:nullable="true"
         rs:write="true" rs:basetable="shippers"
         rs:basecolumn="Phone">
         <s:datatype dt:type="string" dt:maxLength="24"/>
       </s:AttributeType>
       <s:extends type="rs:rowbase"/>
     </s:ElementType>
   </s:Schema>

   <rs:data>
     <z:row ShipperID="1" CompanyName="Speedy Express"
       Phone="(503) 555-9831"/>
     <z:row ShipperID="2" CompanyName="United Package"
       Phone="(503) 555-3199"/>
     <z:row ShipperID="3" CompanyName="Federal Shipping"
       Phone="(503) 555-9931"/>
   </rs:data>
</xml>

That has beent taken straight from the ADO documentation.

Now when I use that as follows in an ASP page it works fine:

<%@ Language="VBScript" CodePage="65001"%>
<%
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open Server.MapPath("test2009033003.xml")
Response.ContentType = "application/xml"
rs.Save Response, 1
%>

The XML is sent to the browser.

So you don't need any connection string but as said, parsing arbitrary 
XML is not possible I think. Consider to use MSXML for that, it can be 
used in classic ASP just fine.




-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent