ADO Recordset另存为XML错误 [英] ADO Recordset Save as XML error
问题描述
当我尝试将ASP页面中的记录集保存为XML时,我得到
以下错误(代码如下) - 我安装了ADO 2.8并且这个
在win XP sp2上运行:
----------------------------- -----------------------------
ADODB.Recordset error''800a0bb9''
参数类型错误,超出可接受的范围,或者彼此之间发生冲突。
----------------------------------------------- -----------
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = 1 >
Const adPersistXML = 1
Dim rS
Dim conn
Dim sql
Dim xmlDoc
设置rS = Server.CreateObject(" ADODB.Recordset")
Response.ContentType =" text / xml"
设置conn = Server.CreateObject(" ADODB.Connection")
conn.Op enDSN = 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
设置conn = nothing
设定rs =无任何
--------------------------- --------------------------------
有什么想法吗?谢谢。
Pierre
Kasp写道:当我尝试并从ASP页面保存记录集作为XML我得到
以下错误(代码如下) - 我安装了ADO 2.8并且
这是在win XP sp2上运行的:
----------------------------------------------- -----------
ADODB.Recordset错误''800a0bb9''
参数类型错误,超出可接受的范围,或者
------------------------------- ---------------------------
哪行代码导致此错误?
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = 1
Const adPersistXML = 1
Dim rS > Dim conn
Dim sql
Dim xmlDoc
设置rS = Server.CreateObject(" ADODB.Recordset")
Response.ContentType =" text / xml"
设置conn = Server.CreateObject(" ADODB.Connection")
conn.OpenDSN = Test; UID = sa; PWD ="
你在申请时使用sa ???糟糕的主意。
设置xmlDoc = Server.CreateObject(" Microsoft.XmlDom")
尝试:
set xmlDoc = Server.CreateObject(" msxml2.DomDocument")
xmlDoc.async = false
xmlDoc.preservewhitespace = false
sql =" SELECT * FROM test"
rS.open sql,conn,adOpenStatic,adLockReadOnly,adCmdText
与您的问题无关,但为什么要使用静态游标?你只需要一个前向
光标:
set rs = conn.execute(sql ,, adCmdText)
我会在做任何事情之前测试一下EOF ...
rS.save xmlDoc,adPersistXML
rS.close
设置conn = nothing
设置rs =没什么
--------------------------------------- --------------------
任何想法?谢谢。
Pierre
-
Microsoft MVP - ASP / ASP.NET
请回复新闻组。我的From
标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。
> Kasp写道:当我尝试将一个记录集从ASP页面保存为XML时,我得到了
以下错误(代码如下) - 我已经安装了ADO 2.8并且这是在win XP sp2上运行的:
------------------------- ---------------------------------
ADODB.Recordset错误''800a0bb9''
参数类型错误,超出可接受的范围,或彼此冲突。
--------- -------------------------------------------------
哪行代码导致此错误?
rS.save xmlDoc,adPersistXML
< blockquote class =post_quotes>Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = 1
Const adPersistXML = 1
> Dim rS
Dim conn
Dim sql
Dim xmlDoc
设置rS = Server.CreateObject( " ADODB.Recordset")
Response.ContentType =" text / xml"
设置conn = Server.CreateObject(" ADODB.Connection")
conn.Open DSN =测试; UID = sa; PWD ="
你正在使用sa作为应用程序???不好主意。
它只用于测试
设置xmlDoc = Server.CreateObject(" Microsoft.XmlDom")
尝试:
设置xmlDoc = Server.CreateObject(" msxml2.DomDocument")
同样的错误
xmlDoc.async = false
xmlDoc.preservewhitespace = false
sql =" SELECT * FROM test"
rS.open sql,conn,adOpenStatic,adLockReadOnly,adCmdText
与您的问题无关,但为什么使用静态游标?你需要一个前置光标:
设置rs = conn.execute(sql ,, adCmdText)
我会在做任何事情之前测试rs的EOF它...
rS.save xmlDoc,adPersistXML
rS.close
设置conn =无
设置rs = Nothing
------------------------------------------- ----------------
任何想法?谢谢。
Pierre
" Kasp" < KA ** @ skynet.be>在留言中写道
新闻:mn *********************** @ skynet.be ...当我尝试将一个记录集从ASP页面保存为XML时,我得到了
以下错误(代码如下) - 我安装了ADO 2.8,这个在win XP sp2上运行:
------------------------------------------ ----------------
ADODB.Recordset错误''800a0bb9''
参数类型错误,出来了可接受的范围,或彼此之间的冲突。
-------------------------- --------------------------------
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdText = 1
Const adPersistXML = 1
昏暗的角色
昏暗的sql
昏暗的xmlDoc
设置rS = Server.CreateObject(" ADODB.Recordset")
Response.ContentType =" text / xml"
设置conn = Server.CreateObject(" ADODB.Connection")
conn.Ope nDSN =测试; UID = sa; PWD ="
设置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
设置conn =没有
设置rs = Nothing
----------------- ------------------------------------------
任何想法?谢谢。
Pierre
我测试了你的代码并且它有效。我在
连接字符串和sql语句中所做的唯一修改。我使用了一个UDL文件作为
连接字符串并使用了我自己的测试表,因为你没有在测试表上提供
的详细信息。
1.您使用的数据库/版本是什么?
2.测试表的DDL(数据定义语言)是什么?
3.您在DSN条目中使用的测试提供商是什么?数据库?
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
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: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?
rS.save xmlDoc, adPersistXML
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.
It is only for testing
set xmlDoc=Server.CreateObject("Microsoft.XmlDom")
Try:
set xmlDoc=Server.CreateObject("msxml2.DomDocument")
same error
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
"Kasp" <ka**@skynet.be> wrote in message
news:mn***********************@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?
这篇关于ADO Recordset另存为XML错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!