#12005/7/31 20:13:17
我现在有一段程序调试有问题请高手帮忙看看。5D论坛做的真好,3年前我就是在5D论坛上高手给我解决了一个难题是关于财务的程序上显示没有“,”只是一个“.”我检查了5、6遍都没有发现错误。呵呵 说正题:这段程序如下:(一运行就说没有End)
<title>管理设备</title>
<%dim action,searchkey,categoryid,jiage,selectid
categoryid=Cint(request.form("categoryid"))
jiage=FormatSQL(request.form("jiage"))
action= FormatSQL(SafeRequest("action",1))
searchkey=FormatSQL(SafeRequest("searchkey",0))
if categoryid="" then categoryid= FormatSQL(SafeRequest("categoryid",1))
if jiage="" then jiage= FormatSQL(SafeRequest("jiage",1))
if action="" then action=Cint(request.form("action"))
if searchkey="" then searchkey=trim(request.form("searchkey"))
selectid=request.form("selectid")
if selectid<>"" then
if session("rank")>2 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权管理设备!');history.go(-1);</script>"
response.End
end if
conn.execute "delete from product where id in ("&selectid&")"
response.Redirect "chkpro.asp"
response.End
end if
%>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6699cc">
<tr>
<td align="center"><font color="#FFFFFF">设备查询</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<form name="form2" method="post" action="chkpro.asp">
<td>
<input name="searchkey" type="text" size="15" maxlength="15">
<select name="action" id="action">
<option value="1" selected>是否到货</option>
<option value="2" selected>买方合同</option>
</select>
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select * from category order by categoryorder",conn,1,1
%>
<select name="categoryid">
<option value="0">所有分类</option>
<%do while not rs.eof%>
<option value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option>
<%rs.movenext
loop
rs.close
set rs=nothing%>
</select>
<input type="submit" name="Submit2" value="查 找" onClick="return checkk();">
</td>
</form>
</tr>
</table><br>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#6699cc">
<tr>
<td height="20" align="center"><font color="#FFFFFF">设备查看与修改</font></td>
</tr>
<tr>
<td height="100" bgcolor="#FFFFFF">
<%
Const MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(SafeRequest("page",1)) then
currentPage=Cint(SafeRequest("page",1))
else
currentPage=1
end if
set rs=server.CreateObject("adodb.recordset")
if jiage=0 then '//普通查询
select case action
case "1"
rs.open "select * from product where nowyesor like '%"&searchkey&"%' ",conn,1,1
end select
else
'//高级查询
if categoryid<>0 then '//判断查询分类,分类不为空。
select case action
case "1"
rs.open "select * from product where nowyesor like '%"&searchkey&"%' and price2<"&jiage&" and categoryid="&categoryid,conn,1,1
end select
else
'//分类为空。
select case action
case "1"
rs.open "select * from product where nowyesor like '%"&searchkey&"%' and price2<"&jiage,conn,1,1
end select
if err.number<>0 then
response.write "数据库中暂时无数据"
end if
if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 数据库中暂时无数据!</p>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"chkpro.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"chkpro.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"chkpro.asp"
end if
end if
end if
sub showContent
dim i
i=0%>
<table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="#FFFFFF" align="center" height="20">
<td width="30%">设备名称</td>
<td width="45%">制造厂商</td>
<td width="17%">加入时间</td>
<td width="8%">选 择</td>
</tr>
<%
do while not rs.eof%>
<tr bgcolor="#FFFFFF" align="center">
<td align="left"> <a href=editpro.asp?id=<%=rs("id")%>>
<% if len(trim(rs("name")))>20 then
response.write left(trim(rs("name")),18)&"..."
else
response.write trim(rs("name"))
end if%>
</a></td>
<td align="left">
<%if len(trim(rs("introduce")))>30 then
response.write left(trim(rs("introduce")),28)&"..."
else
response.write trim(rs("introduce"))
end if%>
</td>
<td nowrap><%=rs("adddate")%></td>
<td align="center"><input name="selectid" type="checkbox" id="selectid" value="<%=rs("id")%>"></td>
</tr>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
<tr bgcolor="#FFFFFF">
<td height="30" colspan="4" align="right">全选 <input type="checkbox" name="checkbox2" value="Check All" onClick="mm()"> <input type="submit" name="Submit" value="删 除" onClick="return test();">
</td>
</tr>
</table>
<form method=Post action=<% = filename %>?searchkey=<% = searchkey %>&action=<% = action %>&categoryid=<% = categoryid %>&jiage=<% = jiage %>>
<p align="center"><%
End Sub
Function showpage(totalnumber,maxperpage,filename)
Dim n
If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If %> </p>
<% If CurrentPage<2 Then %> <div align="center">首 页 上一页 <% Else %>
<div align="center"><a href=<% = filename %>?page=1&searchkey=<% = searchkey %>&action=<% = action %>&categoryid=<% = categoryid %>&jiage=<% = jiage %>>首
页</a> <a href=<% = filename %>?page=<% = CurrentPage-1 %>&searchkey=<% = searchkey %>&action=<% = action %>&categoryid=<% = categoryid %>&jiage=<% = jiage %>>上一页</a>
<% End If
If n-currentpage<1 Then %> 下一页 末 页 <% Else %> <a href=<% = filename %>?page=<% = (CurrentPage+1) %>&searchkey=<% = searchkey %>&action=<% = action %>&categoryid=<% = categoryid %>&jiage=<% = jiage %>>下一页</a>
<a href=<% = filename %>?page=<% = n %>&searchkey=<% = searchkey %>&action=<% = action %>&categoryid=<% = categoryid %>&jiage=<% = jiage %>>末
页</a> <% End If %> 第 <b><% = CurrentPage %></b> 页 共 <b><% = n %></b> 页
共查询到 <b><% = totalnumber %></b> 件设备 转到第
<input type="text" name="page" size=2 maxlength=10 value=<% = currentpage %>>
页
<input type='submit' class='contents' value='跳转' name='cndok'>
</div>
<%
End Function
%>
<div align="center"></div></form>
</td></tr> </table>