
请哪位大虾帮我看下,哪里出了问题?谢谢!
我的这些代码是做一个:通过变量table,来打开数据库中不同的数据表,第一个RS主要起到查询数据表中有多少条记录和实现上一条记录下一条记录等功能。第二个RS是打开数据库中...
我的这些代码是做一个:通过变量table,来打开数据库中不同的数据表,第一个RS主要起到查询数据表中有多少条记录和实现上一条记录下一条记录等功能。第二个RS是打开数据库中的记录,DIR是数据库中的指向文件的路径,然后再打开文件。TIMES是数据库打开文件次数的字段。现在老是在
RS1(TIMES)=RS1(TIMES)+1 这个地方出错,说:错误类型:(0x80020009)发生意外。第 32 行
代码如下:
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>电子书阅读</title>
<%
dim rs1,sql1,dir,table
page=clng(request("page"))
table=cstr(request("table"))
if table="" then table="book"
dim rs,sql
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from " & table
rs.open sql,conn,1,1
book_count=rs.recordcount
rs.close
set rs=nothing
Set rs1 = Server.CreateObject("ADODB.Recordset")
dim page,no_id
if page="" then page=book_count+22
if page<22 then page=book_count+22
if page>(book_count+22) then page=book_count+22
no_id=page-21
sql1="select * from " & table & " where id=" & page
rs1.open sql1,conn,1,3
rs1("times")=rs1("times")+1 ---第32行
rs1.update
dir=rs1("dir")
function HTMLFormat(text)
if text<>"" then
str=text
str=replace(str,"&","&")
str=replace(str,"<","<")
str=replace(str,">",">")
str=replace(str,"","")
str=replace(str,vbcrlf,"<br>")
HTMLFormat=str
else
HTMLFormat=text
end if
end function
Dim fso, ts, text
Const ForReading = 1
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(dir , ForReading)
text = HTMLFormat(ts.ReadAll)
ts.close
%>
</head>
<body style="font-size:12px; color:#FFFFFF;">
<table width="550" cellspacing="0" cellpadding="0">
<tr>
<td height="30" background="images/text_bg.jpg">书目名称:<% =rs1("bookname") %></td>
</tr>
<tr>
<td background="images/textbody_bg.jpg"><% =text %></td>
</tr>
<tr>
<td height="30" align="right" valign="top" background="images/text_bg.jpg" style="padding-right:40px; padding-top:15px;">
共 <font color="#00FF00"><b><% =book_count %>
</b></font> 本书 第 <font color="#00FF00"><b>
<% =no_id %>
</b></font> 本
<% if page>22 then %>
<a href="book_text.asp?page=<% =(page-1) %>"><b>上一本</b></a>
<% end if %>
<% if id<>(book_count+22) then %>
<a href="book_text.asp?page=<% =(page+1) %>"><b>下一本</b></a>
<% end if %>
</td>
</tr>
</table>
<a href="book_text.asp?table=book">book</a> <a href="book_text.asp?table=l_asp_01">l_asp_01</a> <a href="book_text.asp?table=l_asp_02">l_asp_02</a> <a href="book_text.asp?table=story">story</a>
</body>
</html> 展开
RS1(TIMES)=RS1(TIMES)+1 这个地方出错,说:错误类型:(0x80020009)发生意外。第 32 行
代码如下:
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>电子书阅读</title>
<%
dim rs1,sql1,dir,table
page=clng(request("page"))
table=cstr(request("table"))
if table="" then table="book"
dim rs,sql
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from " & table
rs.open sql,conn,1,1
book_count=rs.recordcount
rs.close
set rs=nothing
Set rs1 = Server.CreateObject("ADODB.Recordset")
dim page,no_id
if page="" then page=book_count+22
if page<22 then page=book_count+22
if page>(book_count+22) then page=book_count+22
no_id=page-21
sql1="select * from " & table & " where id=" & page
rs1.open sql1,conn,1,3
rs1("times")=rs1("times")+1 ---第32行
rs1.update
dir=rs1("dir")
function HTMLFormat(text)
if text<>"" then
str=text
str=replace(str,"&","&")
str=replace(str,"<","<")
str=replace(str,">",">")
str=replace(str,"","")
str=replace(str,vbcrlf,"<br>")
HTMLFormat=str
else
HTMLFormat=text
end if
end function
Dim fso, ts, text
Const ForReading = 1
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(dir , ForReading)
text = HTMLFormat(ts.ReadAll)
ts.close
%>
</head>
<body style="font-size:12px; color:#FFFFFF;">
<table width="550" cellspacing="0" cellpadding="0">
<tr>
<td height="30" background="images/text_bg.jpg">书目名称:<% =rs1("bookname") %></td>
</tr>
<tr>
<td background="images/textbody_bg.jpg"><% =text %></td>
</tr>
<tr>
<td height="30" align="right" valign="top" background="images/text_bg.jpg" style="padding-right:40px; padding-top:15px;">
共 <font color="#00FF00"><b><% =book_count %>
</b></font> 本书 第 <font color="#00FF00"><b>
<% =no_id %>
</b></font> 本
<% if page>22 then %>
<a href="book_text.asp?page=<% =(page-1) %>"><b>上一本</b></a>
<% end if %>
<% if id<>(book_count+22) then %>
<a href="book_text.asp?page=<% =(page+1) %>"><b>下一本</b></a>
<% end if %>
</td>
</tr>
</table>
<a href="book_text.asp?table=book">book</a> <a href="book_text.asp?table=l_asp_01">l_asp_01</a> <a href="book_text.asp?table=l_asp_02">l_asp_02</a> <a href="book_text.asp?table=story">story</a>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询