IF声明 [英] IF Statement

查看:167
本文介绍了IF声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何执行以下操作:


如果记录集为空,则重定向到page1,但如果记录集中有内容,则

重定向到第2页。


谢谢

解决方案

valTemp = rst.RecordCount

Select Case valTemp

案例0

Response.Redirect" nothing_in_there.asp"

Case Else

Response.Redirect" something_in_there.asp"

结束选择


-


问候


Steven Burn

Ur IT Mate Group
www.it-mate.co.uk


保持免费!

" Keith" < @>。在消息新闻中写道:#E ************* @tk2msftngp13.phx.gbl ...

我该怎么做:
,则重定向到第2页。

谢谢



set rs = conn.execute(sql)

if rs.eof then

response.redirect(" page1.asp")

else

response.redirect(" page2.asp")

结束如果

-
http://www.aspfaq.com/

(反向回复地址。)


" Keith" < @>。在消息新闻中写道:#E ************* @tk2msftngp13.phx.gbl ...

我该怎么做:
,则重定向到第2页。

谢谢



> valTemp = rst.RecordCount

Select Case valTemp
Case 0
Response.Redirect" nothing_in_there.asp"
Case Else
Response.Redirect" something_in_there.asp"
结束选择




除了,RecordCount不可用默认光标(-1是

默认),所以你的Else可能总是会开火。


EOF属性会告诉你结果集是否为空而无需

依赖于计数。


A


How can I do the following:

If recordset is empty, redirect to page1 but if recordset has something in,
redirect to page 2.

Thanks

解决方案

valTemp = rst.RecordCount
Select Case valTemp
Case 0
Response.Redirect "nothing_in_there.asp"
Case Else
Response.Redirect "something_in_there.asp"
End Select

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Keith" <@.> wrote in message news:#E*************@tk2msftngp13.phx.gbl...

How can I do the following:

If recordset is empty, redirect to page1 but if recordset has something in, redirect to page 2.

Thanks



set rs = conn.execute(sql)
if rs.eof then
response.redirect("page1.asp")
else
response.redirect("page2.asp")
end if
--
http://www.aspfaq.com/
(Reverse address to reply.)


"Keith" <@.> wrote in message news:#E*************@tk2msftngp13.phx.gbl...

How can I do the following:

If recordset is empty, redirect to page1 but if recordset has something in, redirect to page 2.

Thanks



> valTemp = rst.RecordCount

Select Case valTemp
Case 0
Response.Redirect "nothing_in_there.asp"
Case Else
Response.Redirect "something_in_there.asp"
End Select



Except, RecordCount isn''t available with the default cursor (-1 is the
default), so your Else will probably always fire.

The EOF property will tell you if the resultset is empty without having to
rely on a count.

A


这篇关于IF声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆