| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 465 人关注过本帖
标题:代码有错误?
只看楼主 加入收藏
cnawe
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-4-11
结帖率:100%
收藏
 问题点数:0 回复次数:7 
代码有错误?
<%
If request("Submitok")="AddLoveB" Then
Dim MemberName,MemberID,MemberTitle,TotalLoveB
MemberName=trim(replace(replace(replace(request("MemberName"),"'",""),"[",""),"]",""))
MemberID=trim(replace(replace(replace(request("MemberID"),"'",""),"[",""),"]",""))
ClassID=int(trim(replace(replace(replace(request("ClassID"),"'",""),"[",""),"]","")))
MemberTitle=trim(replace(replace(replace(request("MemberTitle"),"'",""),"[",""),"]",""))
if grade=10 then
sql= "select loveb from Q_Main where Id="&ClassID&""
else
sql="select loveb from Q_Main where (UserID="&UserID&" or UserID1="&UserID&" or UserID2="&UserID&" or UserID3="&UserID&") and Id="&ClassID&" "
end if
set rs=Server.CreateObject("ADODB.recordset")'验证是否为组长或副组长
rs.open sql,conn,1,1
if rs.eof and rs.bof then
rs.close:set rs=nothing:closeconn
call msg("请检查:\n\n你无权操作此项目1!","0")
end if
TotalLoveB=rs(0)
rs.close:set rs=nothing'验证结束,下一步
Elseif request("Submitok")="AddLoveB2" Then'开始加LoveB
Dim LoveBnum,TempContent
MemberName=trim(replace(replace(replace(request.form("MemberName"),"'",""),"[",""),"]",""))
MemberID=trim(replace(replace(replace(request.form("MemberID"),"'",""),"[",""),"]",""))
ClassID=int(request.form("ClassID"))
LoveBnum=int(request.form("LoveBnum"))
TempContent=trim(replace(replace(replace(request.form("TempContent"),"'",""),"[",""),"]",""))&"操作人:"&Username
if grade=10 then
sql= "select loveb from Q_Main where Id="&ClassID&""
else
sql="select loveb from Q_Main where (UserID="&UserID&" or UserID1="&UserID&" or UserID2="&UserID&" or UserID3="&UserID&") and Id="&ClassID&" "
end if
set rs=Server.CreateObject("ADODB.recordset")'验证是否为组长或副组长
rs.open sql,conn,1,1
if rs.eof and rs.bof then
rs.close:set rs=nothing:closeconn
call msg("请检查:\n\n你无权操作此项目2!","0")
end if
TotalLoveB=rs(0)
rs.close:set rs=nothing'验证结束,下一步
if TotalLoveB>=LoveBnum then
conn.execute("update love_main Set loveb=loveb+"&LoveBnum&" where Id="&MemberID)'更新主表love币总数
conn.execute("update Q_Main Set loveb=loveb-"&LoveBnum&" where Id="&ClassID)'更新主表love币总数
call loveb_add(MemberName,LoveBnum,TempContent) '添加币历使记录,在fun.asp中
closeconn
call msg("恭喜!操作成功!","GroupMain.asp?ClassID="&ClassID)
else
closeconn
call msg("奖励失败!\n\n你的群组总财富值过少,让你的成员们多多发贴子吧!\n\n超级群组宗旨:取之于民,用之于民!","-1")
end if
Elseif request("Submitok")="SetJh" Then '设为精华文章
Dim BlogID
ClassID=int(request("ClassID"))
BlogID=int(request("BlogID"))
Call Q_Mainn
conn.execute("update Q_Wz Set Ifjh=1 where Id="&BlogID)
closeconn
response.redirect"GBlogShow.asp?BlogID="&BlogID
Elseif request("Submitok")="DelJh" Then '取消文章
ClassID=int(request("ClassID"))
BlogID=int(request("BlogID"))
Call Q_Mainn
conn.execute("update Q_Wz Set Ifjh=0 where Id="&BlogID)
closeconn
response.redirect"GBlogShow.asp?BlogID="&BlogID
Elseif request("Submitok")="SetTop" Then '固顶
ClassID=int(request("ClassID"))
BlogID=int(request("BlogID"))
Call Q_Mainn
conn.execute("update Q_Wz Set IfTop=1 where Id="&BlogID)
closeconn
response.redirect"GBlogShow.asp?BlogID="&BlogID
Elseif request("Submitok")="DelTop" Then '解除固顶
ClassID=int(request("ClassID"))
BlogID=int(request("BlogID"))
Call Q_Mainn
conn.execute("update Q_Wz Set IfTop=0 where Id="&BlogID)
closeconn
response.redirect"GBlogShow.asp?BlogID="&BlogID
Elseif request("Submitok")="SetPb" Then '屏蔽此贴
ClassID=int(request("ClassID"))
BlogID=int(request("BlogID"))
Call Q_Mainn
conn.execute("update Q_Wz Set Flag=-1 where Id="&BlogID)
closeconn
response.redirect"GBlogShow.asp?BlogID="&BlogID
Elseif request("Submitok")="DelPb" Then '解除屏蔽
ClassID=int(request("ClassID"))
BlogID=int(request("BlogID"))
Call Q_Mainn
conn.execute("update Q_Wz Set Flag=1 where Id="&BlogID)
closeconn
response.redirect"GBlogShow.asp?BlogID="&BlogID
Elseif request("Submitok")="SetSh" Then '点击审核
ClassID=int(request("ClassID"))
BlogID=int(request("BlogID"))
Call Q_Mainn
conn.execute("update Q_Wz Set Flag=1 where Id="&BlogID)
closeconn
response.redirect"GBlogShow.asp?BlogID="&BlogID
Elseif request("Submitok")="DelBlog" Then '删贴
ClassID=int(request("ClassID"))
BlogID=int(request("BlogID"))
BBSnum=int(request("Plnum"))
Call Q_Mainn
conn.execute("delete from Q_Wz where Id="&BlogID)
conn.execute("update Q_Main Set Wznum=Wznum-1,BBSnum=BBSnum-"&BBSnum&" where Id="&ClassID)'版块文章数-1,总评论数
conn.execute("delete from Q_BBS where Q_Wz_ID="&BlogID)
conn.execute("delete from Q_Sc where Q_Wz_ID="&BlogID)
closeconn
response.redirect"GBlogShow.asp?BlogID="&BlogID
Else
BlogID=int(request("BlogID"))
closeconn
response.redirect"GBlogShow.asp?BlogID="&BlogID
End if
%>

[此贴子已经被作者于2007-2-16 0:02:32编辑过]

搜索更多相关主题的帖子: 代码 
2007-02-15 23:51
cnawe
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-4-11
收藏
得分:0 

请各位指点.谢谢.


2007-02-16 00:00
cyc308
Rank: 1
等 级:新手上路
帖 子:83
专家分:0
注 册:2005-5-26
收藏
得分:0 
为什么不用case
2007-02-16 09:17
cnawe
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-4-11
收藏
得分:0 

能否说一下呢.


2007-02-16 10:34
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
这个值的判断可以用select case语句来写比IF语句省事request("Submitok")

select case request("Submitok")
case "SetJh"'设为精华
'……设为精华的代码
case "SetTop"'固顶
'……固顶的代码
'……以此类推。
end select
还有就是某些功能重复的代码,可以考虑写一个公用函数来调用。
2007-02-16 16:08
cnawe
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-4-11
收藏
得分:0 

试试看啦.谢谢.


2007-02-16 20:41
cnawe
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-4-11
收藏
得分:0 
不行呀.

2007-02-16 21:16
cnawe
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-4-11
收藏
得分:0 
再顶一下.有谁看出错误啦,请指教!!!

2007-02-16 21:20
快速回复:代码有错误?
数据加载中...
 
   



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

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