关于函数使用的简单小问题

cwyyoo 2009-07-26 09:57:36
我有现在有个随机函数
<%
Function RndNumber(MaxNum,MinNum)
Randomize
RndNumber=int((MaxNum-MinNum+1)*rnd+MinNum)
RndNumber=RndNumber
End Function
%>

我需要把函数放在以下ASP中使第一行中的VIEW+1变成VIEW+随机

<%
sql = "update postings set views = views + 1 where id = " & id
conn.Execute(sql)
sql = "select title, id, autor, mail, views, replies, datum, datum_updated, message from postings where id = " & id
set rs = conn.Execute(sql)
%>
怎么改.我自己改的没有通过..麻烦高手指点下

<%
DIM SJ
SJ=response.write RndNumber(30,10)
sql = "update postings set views = views + SJ where id = " & id
conn.Execute(sql)
sql = "select title, id, autor, mail, views, replies, datum, datum_updated, message from postings where id = " & id
set rs = conn.Execute(sql)
%>
...全文
18 点赞 收藏 2
写回复
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
hookee 2009-07-26

<%
DIM SJ
SJ = RndNumber(30,10)
response.write SJ
sql = "update postings set views = views + " & SJ & " where id = " & id
conn.Execute(sql)
sql = "select title, id, autor, mail, views, replies, datum, datum_updated, message from postings where id = " & id
set rs = conn.Execute(sql)
%>

回复
wjswshujun 2009-07-26
"update postings set views = views"& cstr(SJ) & " where id =" & id
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告