asp select case 的问题
<%FunctionGetStar(hyBuyCount)selectcasehyBuyCountcase1response.write"<imgsrc=img/1.gi...
<%
Function GetStar(hyBuyCount)
select case hyBuyCount
case 1
response.write"<img src=img/1.gif>"
case 3
response.write"<img src=img/2.gif>"
case 5
response.write"<img src=img/3.gif>"
case 10
response.write"<img src=img/4.gif>"
case 20
response.write"<img src=img/5.gif>"
case else
response.write"<img src=img/6.gif>"
end select
GetStar=text
end function
%>
下面是 调用
<% dim sql.hy1rs
set Hy1Rs=server.CreateObject("adodb.recordset")
sql = "select HyBuyCount from HyClub where HyNumber ='" & HyNumber & "' "
Hy1Rs.Open sql,conn ,1,1
%>
<%=GetStar(Hy1Rs("HyBuyCount"))%>
结果 不显示.. 这是那里的问题 展开
Function GetStar(hyBuyCount)
select case hyBuyCount
case 1
response.write"<img src=img/1.gif>"
case 3
response.write"<img src=img/2.gif>"
case 5
response.write"<img src=img/3.gif>"
case 10
response.write"<img src=img/4.gif>"
case 20
response.write"<img src=img/5.gif>"
case else
response.write"<img src=img/6.gif>"
end select
GetStar=text
end function
%>
下面是 调用
<% dim sql.hy1rs
set Hy1Rs=server.CreateObject("adodb.recordset")
sql = "select HyBuyCount from HyClub where HyNumber ='" & HyNumber & "' "
Hy1Rs.Open sql,conn ,1,1
%>
<%=GetStar(Hy1Rs("HyBuyCount"))%>
结果 不显示.. 这是那里的问题 展开
3个回答
展开全部
你的过程写错了
Function是函数,要有返回值
Sub是过程,直接操作就行了
<%
Function GetStar(hyBuyCount)
select case hyBuyCount
case 1
GetStar = "<img src=img/1.gif>"
case 3
GetStar = "<img src=img/2.gif>"
case 5
GetStar = "<img src=img/3.gif>"
case 10
GetStar = "<img src=img/4.gif>"
case 20
GetStar = "<img src=img/5.gif>"
case else
GetStar = "<img src=img/6.gif>"
end select
end function
%>
或者
<%
Sub GetStar(hyBuyCount)
select case hyBuyCount
case 1
response.write"<img src=img/1.gif>"
case 3
response.write"<img src=img/2.gif>"
case 5
response.write"<img src=img/3.gif>"
case 10
response.write"<img src=img/4.gif>"
case 20
response.write"<img src=img/5.gif>"
case else
response.write"<img src=img/6.gif>"
end select
end Sub
%>
下面调用就行这样
<%
dim sql.hy1rs
set Hy1Rs=server.CreateObject("adodb.recordset")
sql = "select HyBuyCount from HyClub where HyNumber ='" & HyNumber & "' "
Hy1Rs.Open sql,conn ,1,1
if not Hy1Rs.bof and not Hy1Rs.eof then
'Function调用
Response.write GetStar(Hy1Rs("HyBuyCount"))
'Sub调用
GetStar(Hy1Rs("HyBuyCount"))
else
Response.write "没有"
end if
Hy1Rs.close:set Hy1Rs=nothing
%>
如果还不行,可以随时hi我,我会热情回答
Function是函数,要有返回值
Sub是过程,直接操作就行了
<%
Function GetStar(hyBuyCount)
select case hyBuyCount
case 1
GetStar = "<img src=img/1.gif>"
case 3
GetStar = "<img src=img/2.gif>"
case 5
GetStar = "<img src=img/3.gif>"
case 10
GetStar = "<img src=img/4.gif>"
case 20
GetStar = "<img src=img/5.gif>"
case else
GetStar = "<img src=img/6.gif>"
end select
end function
%>
或者
<%
Sub GetStar(hyBuyCount)
select case hyBuyCount
case 1
response.write"<img src=img/1.gif>"
case 3
response.write"<img src=img/2.gif>"
case 5
response.write"<img src=img/3.gif>"
case 10
response.write"<img src=img/4.gif>"
case 20
response.write"<img src=img/5.gif>"
case else
response.write"<img src=img/6.gif>"
end select
end Sub
%>
下面调用就行这样
<%
dim sql.hy1rs
set Hy1Rs=server.CreateObject("adodb.recordset")
sql = "select HyBuyCount from HyClub where HyNumber ='" & HyNumber & "' "
Hy1Rs.Open sql,conn ,1,1
if not Hy1Rs.bof and not Hy1Rs.eof then
'Function调用
Response.write GetStar(Hy1Rs("HyBuyCount"))
'Sub调用
GetStar(Hy1Rs("HyBuyCount"))
else
Response.write "没有"
end if
Hy1Rs.close:set Hy1Rs=nothing
%>
如果还不行,可以随时hi我,我会热情回答
展开全部
i=cint(trim(request("年龄")))
select
case
i
case
(i<8
and
trim(request("性别"))="男")
response.write
"小弟弟"
case
(i>8
and
i<15
and
trim(request("性别"))="男")
response.write
"小男孩"
'以此论退,直到最后
case
(i>81
and
trim(request("性别"))="女")
response.write
"老奶奶"
end
select
select
case
i
case
(i<8
and
trim(request("性别"))="男")
response.write
"小弟弟"
case
(i>8
and
i<15
and
trim(request("性别"))="男")
response.write
"小男孩"
'以此论退,直到最后
case
(i>81
and
trim(request("性别"))="女")
response.write
"老奶奶"
end
select
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
结果不显示,可能是在数据库连接处有错误,比如说Hy1Rs里面根本就没有记录等。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询