主题:超级新手、菜鸟问题。大虾路过不妨发发慈悲!
我的问题是:可以查询出相应的记录,但翻页的时候,提示:
----------------------------------------------------
Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'
ODBC 驱动程序不支持所需的属性。
/zd.asp,行56
----------------------------------------------------
但如果我使用注释的SQL字符串的话,翻页没有问题.
主要代码如下:
<%
'设置的查询以及排序的字符变量
cla=request("f_d1")
dep=request("f_d2")
flag=request("f_d3")
%>
<%
dim cnn,rs,count,pagenum,page,pagecount,curpage
set cnn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
strcnn="DBQ="+server.MapPath("db/zd.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
cnn.Open strcnn
'以下是注释掉的SQL字符串
'sql="select * from regulation order by zd_id asc"
if cla="*" and dep="*" then
sql="select * from regulation order by " & flag
elseif cla="*" then
sql="select * from regulation where department = '"&dep&"'order by " & flag
elseif dep="*" then
sql="select * from regulation where classification ='"&cla&"' order by " & flag
else
sql="select * from regulation where classification ='"&cla&"' and department = '"&dep&"'order by " & flag
end if
'下面这句是第56行
rs.open sql,cnn,1,1
%>
<%
cla=""
dep=""
fla=""
%>
<% if Request.QueryString("pagenum")<>"" then %>
<% pagenum=Request.QueryString("pagenum") %>
<% else %>
<% pagenum=1 %>
<%end if %>
<%
curpage=pagenum
page=15
count=(curpage-1)*page+1
rs.pagesize=page
'pagecount=rs.recordcount/page
for i=1 to count-1
rs.movenext
next
i=1
%>
<% do while (not rs.eof and count<=(curpage)*rs.pagesize) %>
<td width="40" align="center"><%=rs(0)%> </td>
<td width="80" align="left"><%=rs(2)%> </td>
<td width="260" align="left"><%=rs(1)%> </td>
<td width="80" align="center"><%=rs(4)%> </td>
<td width="80" align="center"><%=rs(10)%> </td>
<td width="80" align="center"><%=rs(9)%> </td>
<td width="80" align="center"><%=rs(7)%> </td>
<% rs.Movenext %>
<% count=count+1
i=i+1 %>
<% loop %>
<% if curpage<>1 then %>
<a href="zd.asp?pagenum=1">
首页</a>
<% else %>
首页
<% end if %>
<% if curpage<>1 then %>
<a href="zd.asp?pagenum=<%=curpage-1%>">
前一页 </a>
<% else %>
前一页
<% end if %>
<% if (curpage<>trim(rs.pagecount))and trim(rs.pagecount)<>1 then %>
<a href="zd.asp?pagenum=<%=curpage+1%>">后一页</a>
<% else %>
后一页
<% end if %>
<% if (curpage<>trim(rs.pagecount)) then %>
<a href="zd.asp?pagenum=<%=rs.pagecount%>"> 末页</a>
<% else %>
末页
<% end if %>
<%
cnn.Close
set cnn=nothing
%>
----------------------------------------------------
Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'
ODBC 驱动程序不支持所需的属性。
/zd.asp,行56
----------------------------------------------------
但如果我使用注释的SQL字符串的话,翻页没有问题.
主要代码如下:
<%
'设置的查询以及排序的字符变量
cla=request("f_d1")
dep=request("f_d2")
flag=request("f_d3")
%>
<%
dim cnn,rs,count,pagenum,page,pagecount,curpage
set cnn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
strcnn="DBQ="+server.MapPath("db/zd.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
cnn.Open strcnn
'以下是注释掉的SQL字符串
'sql="select * from regulation order by zd_id asc"
if cla="*" and dep="*" then
sql="select * from regulation order by " & flag
elseif cla="*" then
sql="select * from regulation where department = '"&dep&"'order by " & flag
elseif dep="*" then
sql="select * from regulation where classification ='"&cla&"' order by " & flag
else
sql="select * from regulation where classification ='"&cla&"' and department = '"&dep&"'order by " & flag
end if
'下面这句是第56行
rs.open sql,cnn,1,1
%>
<%
cla=""
dep=""
fla=""
%>
<% if Request.QueryString("pagenum")<>"" then %>
<% pagenum=Request.QueryString("pagenum") %>
<% else %>
<% pagenum=1 %>
<%end if %>
<%
curpage=pagenum
page=15
count=(curpage-1)*page+1
rs.pagesize=page
'pagecount=rs.recordcount/page
for i=1 to count-1
rs.movenext
next
i=1
%>
<% do while (not rs.eof and count<=(curpage)*rs.pagesize) %>
<td width="40" align="center"><%=rs(0)%> </td>
<td width="80" align="left"><%=rs(2)%> </td>
<td width="260" align="left"><%=rs(1)%> </td>
<td width="80" align="center"><%=rs(4)%> </td>
<td width="80" align="center"><%=rs(10)%> </td>
<td width="80" align="center"><%=rs(9)%> </td>
<td width="80" align="center"><%=rs(7)%> </td>
<% rs.Movenext %>
<% count=count+1
i=i+1 %>
<% loop %>
<% if curpage<>1 then %>
<a href="zd.asp?pagenum=1">
首页</a>
<% else %>
首页
<% end if %>
<% if curpage<>1 then %>
<a href="zd.asp?pagenum=<%=curpage-1%>">
前一页 </a>
<% else %>
前一页
<% end if %>
<% if (curpage<>trim(rs.pagecount))and trim(rs.pagecount)<>1 then %>
<a href="zd.asp?pagenum=<%=curpage+1%>">后一页</a>
<% else %>
后一页
<% end if %>
<% if (curpage<>trim(rs.pagecount)) then %>
<a href="zd.asp?pagenum=<%=rs.pagecount%>"> 末页</a>
<% else %>
末页
<% end if %>
<%
cnn.Close
set cnn=nothing
%>