Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XML and ADO (VB) >Thread Next - Re: XML and ADO (VB) Re: XML and ADO (VB)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/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
