ASP数据库批量修改的问题.求助!

andy253982 2008-04-21 02:46:23
本人不才.初学ASP.现在有个问题.这个批量修改的代码哪里有错误啊. 本人不胜感激!QQ:253982
<!--#include file="conn.asp"-->
<title>管理商品</title>
<link href="../images/css.css" rel="stylesheet" type="text/css">
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆!');window.location.href='login.asp';</script>"
response.End
else
if session("flag")>1 then
response.Write "<p align=center><font color=red>您没有此项目管理权限!</font></p>"
response.End
end if
end if
%>
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<%
dim action
action=request.QueryString("action")
select case action
case "prolist"
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from products",conn,1,3
rs("huiyuanjia")=trim(request("huiyuanjia"))
rs.update
set rs=nothing
response.Write "<script language=javascript>alert('修改成功!');history.go(-1);</script>"
response.End
end select
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#6699cc">
<tr>
<td align="center" background="../images/admin_bg_1.gif" height="25"><b><font color="#ffffff">品批量修改功能</font></b>
...全文
71 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
erdong988 2008-04-21
建议:
说明调试时出错提示是什么,再把相关代码贴出来就行
回复
andy253982 2008-04-21
</td>
</tr>
<tr>
<form name="chkform" method="post" action="prolist.asp?action=prolist">
<td bgcolor="#FFFFFF"><br>
<%
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")
select case selectm
case ""
rs.open "select * from [products] order by bookid desc",conn,1,1

end select

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,"prolist.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"prolist.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"prolist.asp"
end if
end if
end if

sub showContent
dim i,iii
i=0
iii = 0 %>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#A4B6D7">
<tr bgcolor="#A4B6D7" height="25">
<td width="8%" align="center">ID</td>
<td width="17%" align="center">商品名称</td>
<td width="7%" align="center">商品编号</td>
<td width="5%" align="center">规格</td>
<td width="8%" align="center">市场价</td>
<td width="8%" align="center">会员价</td>
<td width="8%" align="center">VIP价</td>
<td width="8%" align="center">成本</td>
<td width="8%" align="center">库存</td>
<td width="6%" align="center">单位</td>
<td width="8%" align="center">积分</td>
<td width="5%" align="center">修改</td>

</tr>
<%
do while not rs.eof
iii = iii +1
if iii mod 2 = 0 then %>
<tr bgcolor="#FFFFFF" align="center" height="28">
<% else %>
<tr bgcolor="#EFEFEF" height="28">
<% end if %>
<td align="center"><a href=editproduct.asp?id=<%=rs("bookid")%>><%=rs("bookid")%></a></td>
<td align="left"><input name="bookname" type="text" id="bookname" value="<% = rs("bookname") %>" size="20"></td>
<td align="center">
<input name="grade" type="text" id="grade" value="<%=rs("grade") %>" size="6"></td>
<td align="center">
<input name="isbn" type="text" id="isbn" value="<%=rs("isbn") %>" size="3"></td>
<td align="center">
<input name="shichangjia" type="text" id="shichangjia" value="<%=rs("shichangjia") %>" size="6"></td>
<td align="center">
<input name="huiyuanjia" type="text" id="huiyuanjia" value="<%=rs("huiyuanjia") %>" size="6"></td>
<td align="center">
<input type="text" name="vipjia" size="6" value="<%=rs("vipjia") %>"></td>
<td align="center">  </td>
<td align="center">
<input name="kucun" type="text" id="kucun" ONKEYPRESS="event.returnValue=IsDigit();" value="<%= rs("kucun") %>" size="5"></td>
<td align="center">
<input name="bookchuban" type="text" id="bookchuban" onKeyPress="event.returnValue=IsDigit();" value="<%= rs("bookchuban") %>" size="3"></td>
<td align="center">
<input name="yeshu" type="text" id="yeshu" ONKEYPRESS="event.returnValue=IsDigit();" value="<%= rs("yeshu") %>" size="3"></td>
<td align="center"><a href=editproduct.asp?id=<%=rs("bookid")%>>修改</a>
</td>
<input type="hidden" name="updateid" value="<%=rs("bookid")%>">
</tr>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
<tr align="center" bgcolor="#FFFFFF">
<td height="30" colspan="14">
<INPUT type="hidden" name="action" value="">
<INPUT type="button" value="更新商品!" onclick="document.chkform.action.value='update'; document.chkform.submit();">
点更新商品后可以批量修改商品数据!    </td>
</tr>
</table>
<%
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

Response.Write "<form method=Post action="&filename&"?selectm="&selectm&"&selectkey="&selectkey&" >"
Response.Write "<p align='center' class='contents'> "
If CurrentPage<2 Then
Response.Write "<font class='contents'>首 页 上一页</font> "
Else
Response.Write "<a href="&filename&"?page=1&selectm="&selectm&"&selectkey="&selectkey&"&cid="&cid&" class='contents'>首 页</a> "
Response.Write "<a href="&filename&"?page="¤tPage-1&"&selectm="&selectm&"&selectkey="&selectkey&"&cid="&cid&" class='contents'>上一页</a> "
End If

If n-currentpage<1 Then
Response.Write "<font class='contents'>下一页 末 页</font>"
Else
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&selectm="&selectm&"&selectkey="&selectkey&"&cid="&cid&" class='contents'>"
Response.Write "下一页</a> <a href="&filename&"?page="&n&"&selectm="&selectm&"&selectkey="&selectkey&"&cid="&cid&" class='contents'>末 页</a>"
End If
Response.Write "<font class='contents'> 页次:</font><font class='contents'>"¤tPage&"</font><font class='contents'>/"&n&"页</font> "
Response.Write "<font class='contents'> 共有"&totalnumber&"种商品 "
Response.Write "<font class='contents'>转到第:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="¤tpage&">页"
Response.Write " <input type='submit' class='contents' value='跳转' name='cndok' ></form>"
End Function
%></td>
</form>
</tr>
</table>
<br>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6699cc">
<tr>

</tr>

</table>

<!--#include file="foot.asp"-->
<script language=javascript>

function mm()
{
var a = document.getElementsByTagName("input");
if(a[0].checked==true){
for (var i=0; i<a.length; i++)
if (a[i].type == "checkbox") a[i].checked = false;
}
else
{
for (var i=0; i<a.length; i++)
if (a[i].type == "checkbox") a[i].checked = true;
}
}

function IsDigit()
{
return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
</script>
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2008-04-21 02:46
社区公告
暂无公告