| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4745 人关注过本帖
标题:数据库连接问题----ADODB.Recordset 错误 '800a0e7d'
只看楼主 加入收藏
l900
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-6-10
收藏
 问题点数:0 回复次数:8 
数据库连接问题----ADODB.Recordset 错误 '800a0e7d'

红色标注语句为74行
当rs.open sql出现如下错误信息:
ADODB.Recordset 错误 '800a0e7d'

连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。

/1111/index.asp, 行74
当rs.open sql,conn,1,1出现如下错误信息:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

ODBC 驱动程序不支持所需的属性。

/1111/index.asp, 行74

-------------------------------------------------------------------------------

代码如下
<!--#include file="conndb.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新闻管理</title>
<style type="text/css">
<!--
body {
font-family: "仿宋_GB2312";
font-size: 9pt;
}
a {
font-family: "仿宋_GB2312";
font-size: 9pt;
color: #333333;
}
.style1 {color: #0099CC}
-->
</style>
</head>

<body>
<form name="form1" method="post" action="">
<div align="center">
<h3>新闻管理</h3>
</div>
<table align=center border='0' width='100%'>
<tr>
<td width="21%" align='left'><pre><a href='index.asp'>全部新闻</a><%
dim rs,rscate
set rs=server.CreateObject("adodb.recordset")
set rscate=server.CreateObject("adodb.recordset")
dim sql_where,iflag
iflag=request.QueryString("flag")
set rscate=conn.execute("select * from category order by cateid")
do while not rscate.eof
stile=rscate("catename")
cid=rscate("cateid")
%>|<a href="index.asp?flag=<%= cid %>"><%= stile %></a><% rscate.movenext
loop %>
</pre></td>
<td width="79%" align="right">
<pre><span class="style1"><a href="search.asp">新闻查询</a> <a href="PwdChange.asp">更改密码</a></span><%
if session("username")="admin" then
%><a href="cate_admin.asp"><font color=red></font>类别管理</a><a href="userlist.asp"><font color=red></font>用户管理</a><%
sql_where=""
else
sql_where="poster='"&trim(session("username"))&"'"
end if
%> <a href="exit.asp">退出登陆</a> </pre></td></TR></table>
<table height="20"width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#0099CC">
<tr>
<td width="55%"><div align="center"><font color="#FFFFFF">题目</font></div></td>
<td width="27%"><div align="center"><font color="#FFFFFF">时间</font></div></td>
<td width="9%"><div align="center"><font color="#FFFFFF">修改</font></div></td>
<td width="9%"><div align="center"><font color="#FFFFFF">选择</font></div></td>
</tr>
</table>

<%
if iflag="" then
if sql_where="" then
sql="select * from news order by posttime desc"
else
sql="select * form news where "&sql_where&" order by posttime desc"
end if
else
if sql_where="" then
sql="select * from news where cateid="&iflag&" order by posttime desc"
else
sql="select * from news where "&sql_where&"and cateid="&iflag&" order by desc"
end if
end if
rs.open sql,conn,1,1
if rs.eof then%>
<table><tr><td align="center">目前记录无!</td></tr></table>
<%
else
rs.pagesize=20
page=clng(request("page"))
if page<1 then page=1 end if
if page>rs.pagecount then page=rs.pagecount end if
for i=1 to rs.pagesize
%>
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#CCCCCC" >
<tr>
<td width="55%"><a href="newsview.asp?id=<%= rs("id") %>" onClick="return newwin(this.href)"><% rs(title) %></a></td>
<td width="27%" align="center"><%= rs("posttime") %></td>
<td width="9%" align="center"><a href="newsedit.asp?id="<%= rs("id") %>"" onClick="return newwin(this.href)">修改</a></td>
<td width="9%" align="center"><input type="checkbox" name="checkbox" id="<%= rs("id") %>"></td>
</tr>
</table>
<%rs.movenext()
next
if rs.pagecount>1 then
%>
<table><tr><td>分页:</td>
<%
for i=1 to rs.pagecount
%>
<td><a href="index.asp?flag="&iflag&"&page="&i&""><%= "&i&" %></a></td>
</tr></table>
<%next
end if
end if

%>
<p>&nbsp;</p>
<pre></p>
</pre>

</form>
</body>
</html>



红色标注语句为74行
当rs.open sql出现如下错误信息:
ADODB.Recordset 错误 '800a0e7d'

连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。

/1111/index.asp, 行74
当rs.open sql,conn,1,1出现如下错误信息:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

ODBC 驱动程序不支持所需的属性。

/1111/index.asp, 行74

[此贴子已经被作者于2007-6-23 18:16:50编辑过]

搜索更多相关主题的帖子: Recordset 数据库 ADODB 
2007-06-23 18:15
sdgjsddd
Rank: 1
等 级:新手上路
帖 子:199
专家分:0
注 册:2007-6-14
收藏
得分:0 

你只写一个最简单的连接数据库的代码,用select和from显示一下结果,看看有没有问题(检查一下)

2007-06-23 19:03
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
收藏
得分:0 
set rs=conn.execute(sql)
这样试试

其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2007-06-23 20:51
alxw4616
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-6-23
收藏
得分:0 
在74行前加入
response.wirte(sql)
response.end()
看一下你执行的sql语句到底是怎么的.我估计 应该是空格的问题.

2007-06-23 22:18
l900
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-6-10
收藏
得分:0 
以下是引用alxw4616在2007-6-23 22:18:57的发言:
在74行前加入
response.wirte(sql)
response.end()
看一下你执行的sql语句到底是怎么的.我估计 应该是空格的问题.

出现如下错误

Microsoft VBScript 运行时错误 错误 '800a01b6'

对象不支持此属性或方法: 'Response.wirte'

/1111/index.asp, 行74


2007-06-24 10:49
l900
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-6-10
收藏
得分:0 
以下是引用zhulei1978在2007-6-23 20:51:44的发言:
set rs=conn.execute(sql)
这样试试

出现如下错误提示:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: 'form' 附近有语法错误。

/1111/index.asp, 行75


2007-06-24 10:50
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
sql="select * form news where "&sql_where&" order by posttime desc"
改成from
2007-06-24 11:43
昔日足迹
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2007-6-20
收藏
得分:0 
[CODE]sql="select * from news where cateid="&iflag&" order by posttime desc"
……
sql="select * from news where "&sql_where&"and cateid="&iflag&" order by desc"
[/CODE]

cateid='"&iflag&"' 都要加单引号吧`~

如果我不选择堕落 那么地狱的存在又有何意义
2007-06-24 21:19
hangxj
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2045
专家分:0
注 册:2006-4-10
收藏
得分:0 
以下是引用l900在2007-6-23 18:15:51的发言:

红色标注语句为74行
当rs.open sql出现如下错误信息:
ADODB.Recordset 错误 '800a0e7d'

连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。

/1111/index.asp, 行74
当rs.open sql,conn,1,1出现如下错误信息:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

ODBC 驱动程序不支持所需的属性。

/1111/index.asp, 行74

-------------------------------------------------------------------------------

代码如下
<!--#include file="conndb.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新闻管理</title>
<style type="text/css">
<!--
body {
font-family: "仿宋_GB2312";
font-size: 9pt;
}
a {
font-family: "仿宋_GB2312";
font-size: 9pt;
color: #333333;
}
.style1 {color: #0099CC}
-->
</style>
</head>

<body>
<form name="form1" method="post" action="">
<div align="center">
<h3>新闻管理</h3>
</div>
<table align=center border='0' width='100%'>
<tr>
<td width="21%" align='left'><pre><a href='index.asp'>全部新闻</a><%
dim rs,rscate
set rs=server.CreateObject("adodb.recordset")
set rscate=server.CreateObject("adodb.recordset")
dim sql_where,iflag
iflag=request.QueryString("flag")
set rscate=conn.execute("select * from category order by cateid")
do while not rscate.eof
stile=rscate("catename")
cid=rscate("cateid")
%>|<a href="index.asp?flag=<%= cid %>"><%= stile %></a><% rscate.movenext
loop %>
</pre></td>
<td width="79%" align="right">
<pre><span class="style1"><a href="search.asp">新闻查询</a> <a href="PwdChange.asp">更改密码</a></span><%
if session("username")="admin" then
%><a href="cate_admin.asp"><font color=red></font>类别管理</a><a href="userlist.asp"><font color=red></font>用户管理</a><%
sql_where=""
else
sql_where="poster='"&trim(session("username"))&"'"
end if
%> <a href="exit.asp">退出登陆</a> </pre></td></TR></table>
<table height="20"width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#0099CC">
<tr>
<td width="55%"><div align="center"><font color="#FFFFFF">题目</font></div></td>
<td width="27%"><div align="center"><font color="#FFFFFF">时间</font></div></td>
<td width="9%"><div align="center"><font color="#FFFFFF">修改</font></div></td>
<td width="9%"><div align="center"><font color="#FFFFFF">选择</font></div></td>
</tr>
</table>

<%
if iflag="" then
if sql_where="" then
sql="select * from news order by posttime desc"
else
sql="select * form news where "&sql_where&" order by posttime desc"
end if
else
if sql_where="" then
sql="select * from news where cateid="&iflag&" order by posttime desc"
else
sql="select * from news where "&sql_where&"and cateid="&iflag&" order by desc"
改为 sql="select * from news where "&sql_where&" and cateid="&iflag&" order by desc"

end if
end if
rs.open sql,conn,1,1
if rs.eof then%>
<table><tr><td align="center">目前记录无!</td></tr></table>
<%
else
rs.pagesize=20
page=clng(request("page"))
if page<1 then page=1 end if
if page>rs.pagecount then page=rs.pagecount end if
for i=1 to rs.pagesize
%>
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#CCCCCC" >
<tr>
<td width="55%"><a href="newsview.asp?id=<%= rs("id") %>" onClick="return newwin(this.href)"><% rs(title) %></a></td>
<td width="27%" align="center"><%= rs("posttime") %></td>
<td width="9%" align="center"><a href="newsedit.asp?id="<%= rs("id") %>"" onClick="return newwin(this.href)">修改</a></td>
<td width="9%" align="center"><input type="checkbox" name="checkbox" id="<%= rs("id") %>"></td>
</tr>
</table>
<%rs.movenext()
next
if rs.pagecount>1 then
%>
<table><tr><td>分页:</td>
<%
for i=1 to rs.pagecount
%>
<td><a href="index.asp?flag="&iflag&"&page="&i&""><%= "&i&" %></a></td>
</tr></table>
<%next
end if
end if

%>
<p>&nbsp;</p>
<pre></p>
</pre>

</form>
</body>
</html>



红色标注语句为74行
当rs.open sql出现如下错误信息:
ADODB.Recordset 错误 '800a0e7d'

连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。

/1111/index.asp, 行74
当rs.open sql,conn,1,1出现如下错误信息:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

ODBC 驱动程序不支持所需的属性。

/1111/index.asp, 行74



http://www./
2007-06-25 11:25
快速回复:数据库连接问题----ADODB.Recordset 错误 '800a0e7d'
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016697 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved