Home > Archive > ASP > November 2005 > ADO Recordset Save as XML error
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ADO Recordset Save as XML error
|
|
|
| When I try and save out a recordset from an ASP page as XML I get the
following error (the code is below) - I have ADO 2.8 installed and this
is running on win XP sp2 :
----------------------------------------------------------
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
----------------------------------------------------------
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = 1
Const adPersistXML = 1
Dim rS
Dim conn
Dim sql
Dim xmlDoc
Set rS = Server.CreateObject ("ADODB.Recordset")
Response.ContentType = "text/xml"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=Test;UID=sa;PWD="
set xmlDoc=Server.CreateObject("Microsoft.XmlDom")
xmlDoc.async = false
xmlDoc.preservewhitespace = false
sql = "SELECT * FROM test"
rS.open sql, conn, adOpenStatic, adLockReadOnly, adCmdText
rS.save xmlDoc, adPersistXML
rS.close
Set conn = nothing
Set rs = Nothing
-----------------------------------------------------------
Any ideas? Thanks.
Pierre
| |
| Bob Barrows [MVP] 2005-11-15, 6:55 pm |
| Kasp wrote:
> When I try and save out a recordset from an ASP page as XML I get the
> following error (the code is below) - I have ADO 2.8 installed and
> this is running on win XP sp2 :
>
> ----------------------------------------------------------
>
> ADODB.Recordset error '800a0bb9'
>
> Arguments are of the wrong type, are out of acceptable range, or are
> in conflict with one another.
>
> ----------------------------------------------------------
Which line of code causes this error?
> Const adOpenStatic = 3
> Const adLockReadOnly = 1
> Const adCmdText = 1
> Const adPersistXML = 1
>
> Dim rS
> Dim conn
> Dim sql
> Dim xmlDoc
>
> Set rS = Server.CreateObject ("ADODB.Recordset")
> Response.ContentType = "text/xml"
>
> Set conn = Server.CreateObject("ADODB.Connection")
> conn.Open "DSN=Test;UID=sa;PWD="
You're using sa for an application??? bad idea.
>
> set xmlDoc=Server.CreateObject("Microsoft.XmlDom")
Try:
set xmlDoc=Server.CreateObject("msxml2.DomDocument")
> xmlDoc.async = false
> xmlDoc.preservewhitespace = false
>
> sql = "SELECT * FROM test"
> rS.open sql, conn, adOpenStatic, adLockReadOnly, adCmdText
Nothing to do with your problem, but why use a static cursor? A forwardonly
cursor is all you need:
set rs = conn.execute(sql,,adCmdText)
I would test rs for EOF before doing anything with it ...
> rS.save xmlDoc, adPersistXML
> rS.close
>
> Set conn = nothing
> Set rs = Nothing
>
> -----------------------------------------------------------
> Any ideas? Thanks.
>
> Pierre
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
| |
|
| > Kasp wrote:
>
> Which line of code causes this error?
>
>
rS.save xmlDoc, adPersistXML
>
> You're using sa for an application??? bad idea.
>
It is only for testing
>
> Try:
> set xmlDoc=Server.CreateObject("msxml2.DomDocument")
>
same error
[color=darkred]
>
> Nothing to do with your problem, but why use a static cursor? A forwardonly
> cursor is all you need:
>
> set rs = conn.execute(sql,,adCmdText)
>
>
> I would test rs for EOF before doing anything with it ...
>
| |
| Chris Hohmann 2005-11-15, 6:55 pm |
| "Kasp" <kasp@skynet.be> wrote in message
news:mn.7cae7d5b09f5af76.37276@skynet.be...
> When I try and save out a recordset from an ASP page as XML I get the
> following error (the code is below) - I have ADO 2.8 installed and this
> is running on win XP sp2 :
>
> ----------------------------------------------------------
>
> ADODB.Recordset error '800a0bb9'
>
> Arguments are of the wrong type, are out of acceptable range, or are in
> conflict with one another.
>
> ----------------------------------------------------------
> Const adOpenStatic = 3
> Const adLockReadOnly = 1
> Const adCmdText = 1
> Const adPersistXML = 1
>
> Dim rS
> Dim conn
> Dim sql
> Dim xmlDoc
>
> Set rS = Server.CreateObject ("ADODB.Recordset")
> Response.ContentType = "text/xml"
>
> Set conn = Server.CreateObject("ADODB.Connection")
> conn.Open "DSN=Test;UID=sa;PWD="
>
> set xmlDoc=Server.CreateObject("Microsoft.XmlDom")
> xmlDoc.async = false
> xmlDoc.preservewhitespace = false
>
> sql = "SELECT * FROM test"
> rS.open sql, conn, adOpenStatic, adLockReadOnly, adCmdText
> rS.save xmlDoc, adPersistXML
> rS.close
>
> Set conn = nothing
> Set rs = Nothing
>
> -----------------------------------------------------------
> Any ideas? Thanks.
>
> Pierre
>
>
I tested your code and it works. The only modifications I made where to the
connection string and the sql statement. I used a UDL file for the
connection string and used my own test table since you did not provide
details on your test table.
1. What database/version are you using?
2. What's the DDL (Data Definition Language) for the test table?
3. What provider are you using in your DSN entry for the "Test" database?
| |
|
| Xref: TK2MSFTNGP08.phx.gbl microsoft.public.inetserver.asp.general:299672
> "Kasp" <kasp@skynet.be> wrote in message
> news:mn.7cae7d5b09f5af76.37276@skynet.be...
> I tested your code and it works. The only modifications I made where to the
> connection string and the sql statement. I used a UDL file for the connection
> string and used my own test table since you did not provide details on your
> test table.
>
> 1. What database/version are you using?
>
Oracle 9.2
> 2. What's the DDL (Data Definition Language) for the test table?
>
what is a dll for a table?
> 3. What provider are you using in your DSN entry for the "Test" database?
Provider=MSDASQL.1;
Extended Properties="DSN=Test;UID=xxx;PWD=xxx;SERVER=Test;"
If I use this code in VB it is working !
If I save the record in a text file, it is working !!
| |
| Chris Hohmann 2005-11-15, 6:55 pm |
| [snip]
>
> Oracle 9.2
This was a pretty important piece of information missing from your original
post. More on this below.
>
> what is a dll for a table?
Not DLL, DDL. It stands for Data Definition Language. Specifically, can you
provide the "CREATE TABLE" statement for the "Test" table. That will let us
know what the datatype/sizes are for each of the columns in your table. Of
particular interest in this situation would be any columns that are mapped
as adVariant, adIDispatch or adIUnknown in ADO. There's a note in the
documentation for the Save method of the Recordset object about fields of
these datatypes not being supported.
>
> Provider=MSDASQL.1;
> Extended Properties="DSN=Test;UID=xxx;PWD=xxx;SERVER=Test;"
Have you tried using the native Oracle provider instead of the Microsoft
Oracle provider?
> If I use this code in VB it is working !
Can we see the code?
> If I save the record in a text file, it is working !!
Can we see the code?
| |
| Bob Barrows [MVP] 2005-11-15, 6:55 pm |
| Kasp wrote:
>
> rS.save xmlDoc, adPersistXML
>
This is sounding like either an MDAC problem or a problem with the MSXML
parser, with the former being more likely. You should try upgrading both to
the latest versions. Run Component Checker (a download from Microsoft) to
verify that you have no MDAC problems on the server.
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"
| |
|
| > [snip]
>
> This was a pretty important piece of information missing from your original
> post. More on this below.
>
>
>
> Not DLL, DDL. It stands for Data Definition Language. Specifically, can you
> provide the "CREATE TABLE" statement for the "Test" table. That will let us
> know what the datatype/sizes are for each of the columns in your table. Of
> particular interest in this situation would be any columns that are mapped as
> adVariant, adIDispatch or adIUnknown in ADO. There's a note in the
> documentation for the Save method of the Recordset object about fields of
> these datatypes not being supported.
>
>
where can I find this information?
>
> Have you tried using the native Oracle provider instead of the Microsoft
> Oracle provider?
>
>
Yes
>
> Can we see the code?
>
>
Private Sub Form_Load()
Dim szConnect As String
Dim SQL As String
szConnect = "Provider=MSDASQL;Data Source=xxx;User
Id=xxx;Password=xxx"
SQL = "SELECT * FROM bl"
Dim oRS As ADODB.Recordset
Dim oCN As ADODB.Connection
Set oCN = New ADODB.Connection
Set oRS = New ADODB.Recordset
With oCN
.CursorLocation = adUseClient
.ConnectionString = szConnect
.ConnectionTimeout = 5
.Open szConnect
End With
oRS.Open SQL, oCN
Dim xmlDoc As DOMDocument
Set xmlDoc = New DOMDocument
' To specify a specific version, use a declaration like the following,
with the appropriate version in the ProgID:
' Dim xmlDoc As MSXML2.DOMDocument40
' Set xmlDoc = New MSXML2.DOMDocument40
xmlDoc.async = False
oRS.Save xmlDoc, adPersistXML
If xmlDoc.parseError.errorCode <> 0 Then
MsgBox "Errors During Load" & vbCrLf &
xmlDoc.parseError.errorCode & xmlDoc.parseError.reason
Else
MsgBox xmlDoc.XML
End If
oRS.Close
oCN.Close
Set oRS = Nothing
Set oCN = Nothing
End Sub
>
> Can we see the code?
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = 1
Const adPersistXML = 1
Dim rS
Dim conn
Dim sql
Set rS = Server.CreateObject ("ADODB.Recordset")
Response.ContentType = "text/xml"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=Test;UID=sa;PWD="
sql = "SELECT * FROM test"
rS.open sql, conn, adOpenStatic, adLockReadOnly, adCmdText
rS.save "c:\\test.xml", adPersistXML
rS.close
Set conn = nothing
Set rs = Nothing
| |
| Chris Hohmann 2005-11-15, 9:55 pm |
|
"Kasp" <kasp@skynet.be> wrote in message
news:mn.804f7d5b8cf51171.37276@skynet.be...
>
> where can I find this information?
>
It's been some time since I used Oracle, but if I remember correctly, you go
to Enterprise Manager. Double click the table in the object tree on the
left, then select the "show sql" button on the properties dialog box that
comes up.
>
> Yes
I'll assume by "yes", you mean "yes, I tried the native driver and still got
the same error".
>
> Private Sub Form_Load()
>
> Dim szConnect As String
> Dim SQL As String
>
> szConnect = "Provider=MSDASQL;Data Source=xxx;User Id=xxx;Password=xxx"
> SQL = "SELECT * FROM bl"
>
> Dim oRS As ADODB.Recordset
> Dim oCN As ADODB.Connection
>
> Set oCN = New ADODB.Connection
> Set oRS = New ADODB.Recordset
>
> With oCN
> .CursorLocation = adUseClient
> .ConnectionString = szConnect
> .ConnectionTimeout = 5
> .Open szConnect
> End With
>
> oRS.Open SQL, oCN
>
> Dim xmlDoc As DOMDocument
> Set xmlDoc = New DOMDocument
>
> ' To specify a specific version, use a declaration like the following,
> with the appropriate version in the ProgID:
> ' Dim xmlDoc As MSXML2.DOMDocument40
> ' Set xmlDoc = New MSXML2.DOMDocument40
>
> xmlDoc.async = False
> oRS.Save xmlDoc, adPersistXML
>
> If xmlDoc.parseError.errorCode <> 0 Then
> MsgBox "Errors During Load" & vbCrLf & xmlDoc.parseError.errorCode
> & xmlDoc.parseError.reason
> Else
> MsgBox xmlDoc.XML
> End If
>
> oRS.Close
> oCN.Close
> Set oRS = Nothing
> Set oCN = Nothing
>
> End Sub
You are using a different connection string in this code.
>
> Const adOpenStatic = 3
> Const adLockReadOnly = 1
> Const adCmdText = 1
> Const adPersistXML = 1
>
> Dim rS
> Dim conn
> Dim sql
>
> Set rS = Server.CreateObject ("ADODB.Recordset")
> Response.ContentType = "text/xml"
>
> Set conn = Server.CreateObject("ADODB.Connection")
> conn.Open "DSN=Test;UID=sa;PWD="
>
> sql = "SELECT * FROM test"
> rS.open sql, conn, adOpenStatic, adLockReadOnly, adCmdText
> rS.save "c:\\test.xml", adPersistXML
> rS.close
>
> Set conn = nothing
> Set rs = Nothing
Have you checked the resulting test.xml file?
| |
|
| > "Kasp" <kasp@skynet.be> wrote in message
> news:mn.804f7d5b8cf51171.37276@skynet.be...
>
> It's been some time since I used Oracle, but if I remember correctly, you go
> to Enterprise Manager. Double click the table in the object tree on the left,
> then select the "show sql" button on the properties dialog box that comes up.
>
>
>
> I'll assume by "yes", you mean "yes, I tried the native driver and still got
> the same error".
>
>
>
> You are using a different connection string in this code.
>
>
>
> Have you checked the resulting test.xml file?
I found the problem ... It was permition access to the ora92 directory.
Thank you.
--
Pierre
| |
| Bob Barrows [MVP] 2005-11-16, 7:55 am |
| Kasp wrote:
> I found the problem ... It was permition access to the ora92
> directory.
Really??? That usually gives me an "Access Denied" error which is why I
never even considered permissions to be the cause of your issue.
Wait a minute ... you have totally lost me. You are saying that you were
unable to save a recordset to an object that was in memory because of lack
of permissions to a filesystem directory?? Something is not right here ...
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"
|
|
|
|
|