bilfwebb
Nov 25th 2005, 4:30 am
Hello.
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:
<xml>
-
<s: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" rs:precision="10" rs:fixedlength="true"/>
</s:AttributeType>
-
<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" rs:precision="10" rs:fixedlength="true"/>
</s:AttributeType>
-
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")
Response.ContentType="text/xml"
Set objConn = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
objConn.open 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 %>
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:
<xml>
-
<s: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" rs:precision="10" rs:fixedlength="true"/>
</s:AttributeType>
-
<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" rs:precision="10" rs:fixedlength="true"/>
</s:AttributeType>
-
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")
Response.ContentType="text/xml"
Set objConn = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
objConn.open 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 %>