ASP中的SELECT CASE ??? [英] SELECT CASE in ASP???

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

问题描述

亲爱的朋友们,


我很难理解如何在ASP中使用SELECT CASE。我已经在VB中使用了它,但从未在ASP脚本中使用它。


Scenerio:


我有2个文本框在表格上,我必须允许同时进入一个或另一个

或两者。现在我尝试使用If ElseIf,但它太难以跟踪,因此现在我正在使用SELECT CASE语句。


TEXBOX1名为strEnglish

TEXBOX2命名为strFrench


我的代码:

<%

strEnglish = Request.Form( " strEnglish")

strFrench = Request.Form(" strFrench")

选择案例


然后我不知道怎么离开这里,因为我有两个输入文本框来跟随。

我找到了这个例子,但我不知道如何应用它我的情况因为我需要输入2个文本框条目。


<%

UserName = request.form("用户名)

选择案例用户名

案例Kathi

Msg =你值得休息一下。休息一天!

CaseJD,Anne

Msg =别忘了今天打电话给Kathi! br />
Case Else

Msg =我认识你吗?

结束选择

response.write Msg

%>


有人可以帮帮我,一个已知的教程,也许是一个例子或只是

普通好的ole请帮忙吗?


提前致谢,


~新手

解决方案

Newbie于2004年8月7日在microsoft.public.inetserver.asp.general上写道:


我很难理解如何使用SELECT案例在ASP中。我在VB中使用它但从未在ASP脚本中使用它。

Scenerio:

我在表单上有2个文本框,我必须允许它进入一个或
其他或两者同时。现在我尝试使用If ElseIf但是它很难跟踪,所以现在我使用SELECT CASE语句。

TEXBOX1名为strEnglish
TEXBOX2名为strFrench

我的代码:
<%
strEnglish = Request.Form(" strEnglish")
strFrench = Request.Form(" strFrench")

选择案例

然后我不知道该如何离开这里,因为我有2个输入
文本框可供使用。




在这种情况下,并不是我不能使用精选案例来解决问题,

但是知道你想用两个来做什么似乎更有用

字符串。


可能你根本不想使用精选案例!!


<%

strEnglish = Request.Form(" strEnglish")

strFrench = Request.Form(" strFrench")


if strEnglish = strFrench then

t ="这是非常不可能的

其他

t =" 2如果

response.write t

%>


未经测试,但应与以下内容相同:


<%

strEnglish = Request.Form(" strEnglish")

strFrench = Request.Form(" strFrench")

select case strEnglish

case strFrench

t = 这是非常不可能的

案例其他

t ="两种不同的语言通常会产生不同的字符串

结束选择

response.write t

%>


-

Evertjan。

荷兰。

(请在我的电子邮件地址中将x'变为点数)


函数GetResult(str1, str2)

strkey = Trim(str1)&修剪(str2)

Select Case strkey

Case" WhatEver1"

GetResult =" Something1"

案例WhatEver2

GetResult =" Something2"

案例" WhatEver3"

GetResult =" Something3"

Case" WhatEver4"

GetResult =" Something4"

结束选择

结束功能

>
dlbjr

恳求睿智的灌输!


这一切都令人尴尬,因为我无法让它发挥作用。


我有2个输入字符串,其中包含URL'(文本框的内容

字符串不是问题。


我必须允许用户能够输入JUST英语或者只需

法国人或者能够进入英语和法语


我正在使用IF ELSE声明但是很难用它,因为

scenerio的冲突。


示例:


如果strEnglish<>空AND strFrench<>空那么''两者都有里面的东西

他们

''输入数据库

结束如果


如果strEnglish< >空然后''只是英语有东西

里面

''输入只是英文

结束如果


如果strFrench<>空,那么''Just French有一些东西

里面

''输入只是法国人

结束如果

现在有两个字符串文本框输入,它运作良好,但如果我只是在英语或法语中输入
,那么它就不会承认它。 .....


所以我想也许我应该使用CASE SELECT ..但是现在我没有

想法如何使这项工作对于我的代码,特别是在ASP中。


SAD尚未真实...但愿意学习如何使它成为烦恼k ..........但是还有

尚未找到一个让我理解的例子......也许我正在制作

比它更难......我常见的问题。;))


有人可以帮助我,因为我很难把它拿到这里来

工作。


在此先感谢,


~Brad(NEWBIE到ASP CASE选择)


新手 <氖**** @ helpme.com>在留言中写道

新闻:Y0 ********************* @ news20.bellglobal.com ...

亲爱的朋友们,

我很难理解如何在ASP中使用SELECT CASE。我已经在VB中使用它但从未在ASP脚本中使用它。

Scenerio:

我在表单上有两个文本框,我必须允许它进入一个或
其他或两者同时出现。现在我尝试使用If ElseIf,但它很难跟踪,所以现在我使用SELECT CASE语句。

TEXBOX1名为strEnglish
TEXBOX2名为strFrench

我的代码:
<%
strEnglish = Request.Form(" strEnglish")
strFrench = Request.Form(" strFrench")

选择案例

然后我不知道怎么离开这里,因为我有2个输入文本框
要跟随。

我发现这个例子但是我不知道如何将它应用到我的情况,因为
我必须输入2个文本框条目。

<%
UserName = request.form(" UserName" )
选择案例用户名
案例Kathi
Msg =你值得休息一下。休假一天!
案例JD,Anne
Msg =别忘了今天打电话给Kathi!
Case Else Msg =我认识你吗?
结束选择
response.write消息
%>

有人可以帮助我,一个已知的教程,也许是一个例子或者
只是简单的好帮助吗?

提前致谢,

〜新手



Dear friends,

I am having a hard time understanding how to use a SELECT CASE in ASP. I
have used it in VB but never in ASP scripting.

Scenerio:

I have 2 textboxes on a form that I have to allow entry to one or the other
or Both at the same time. Now I tried to use an If ElseIf but it got too
hard to track, so now I am using a SELECT CASE Statement.

TEXBOX1 named strEnglish
TEXBOX2 named strFrench

My code:
<%
strEnglish=Request.Form("strEnglish")
strFrench=Request.Form("strFrench")

Select Case

Then I have no idea how to go from here, because I have 2 input textboxes to
follow.
I found this example but I do not know how to apply it to my situation as I
have to folow 2 textbox entries.

<%
UserName=request.form("UserName")
Select Case UserName
Case "Kathi"
Msg = "You deserve a break. Take the day off!"
Case "JD","Anne"
Msg = "Don''t forget to call Kathi today!"
Case Else
Msg = "Do I know you?"
End Select
response.write Msg
%>

Can someone please help me out, a known tutorial, perhaps an example or just
plain good ole help please??

Thanks in advance,

~Newbie

解决方案

Newbie wrote on 07 aug 2004 in microsoft.public.inetserver.asp.general:


I am having a hard time understanding how to use a SELECT CASE in
ASP. I have used it in VB but never in ASP scripting.

Scenerio:

I have 2 textboxes on a form that I have to allow entry to one or the
other or Both at the same time. Now I tried to use an If ElseIf but
it got too hard to track, so now I am using a SELECT CASE Statement.

TEXBOX1 named strEnglish
TEXBOX2 named strFrench

My code:
<%
strEnglish=Request.Form("strEnglish")
strFrench=Request.Form("strFrench")

Select Case

Then I have no idea how to go from here, because I have 2 input
textboxes to follow.



It is not that I cannot dint a solution using select case in this case,
but it seems far more useful to know what you want to do with the two
strings.

Probably you do not want to use select case after all!!

<%
strEnglish=Request.Form("strEnglish")
strFrench=Request.Form("strFrench")

if strEnglish = strFrench then
t="This is very improbable"
else
t="Two different languages usually produce different strings"
end if
response.write t
%>

not tested, but it should be the same as:

<%
strEnglish=Request.Form("strEnglish")
strFrench=Request.Form("strFrench")

select case strEnglish
case strFrench
t="This is very improbable"
case else
t="Two different languages usually produce different strings"
end select
response.write t
%>


--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


Function GetResult(str1,str2)
strkey = Trim(str1) & Trim(str2)
Select Case strkey
Case "WhatEver1"
GetResult = "Something1"
Case "WhatEver2"
GetResult = "Something2"
Case "WhatEver3"
GetResult = "Something3"
Case "WhatEver4"
GetResult = "Something4"
End Select
End Function

dlbjr
Pleading sagacious indoctrination!


This entire thing is rather embarrassing as I cannto get it to work.

I have 2 input strings that will contain URL''s (the contents of the textbox
strings is a non-issue.

I have to allow the user to be able to enter into JUST the English OR Just
the FRENCH or be able to Enter into BOTH ENGLISH and FRENCH

I was using an IF ELSE statement but was having a hard time with it, as the
scenerio''s conflicted.

Example:

If strEnglish<>empty AND strFrench <>empty Then ''Both have something inside
them
''ENTER BOTH INTO DB
End If

If strEnglish<>empty Then ''Just English has something
inside it
''ENTER JUST THE ENGLISH
End If

If strFrench<>empty Then ''Just French has something
inside it
''ENTER JUST THE FRENCH
End If
Now for BOTH of the string textbox inputs , it worked well, but if I just
entered on either ENGLISH or FRENCH, well it would not acknowledge it......

So I think that maybe I should be using a CASE SELECT..but now I have no
idea how to make that work for my code, especially in ASP.

SAD yet true...but willing to learn how to make it work..........but have
yet to find an example that will make me understand..perhaps I am making it
harder than it is...a usual problem of mine.;))

Can someone help me out here, as I am having a hard time to get this to
work.

Thanks in advance,

~Brad (NEWBIE to ASP CASE Selects)

"Newbie" <Ne****@helpme.com> wrote in message
news:Y0*********************@news20.bellglobal.com ...

Dear friends,

I am having a hard time understanding how to use a SELECT CASE in ASP. I
have used it in VB but never in ASP scripting.

Scenerio:

I have 2 textboxes on a form that I have to allow entry to one or the other or Both at the same time. Now I tried to use an If ElseIf but it got too
hard to track, so now I am using a SELECT CASE Statement.

TEXBOX1 named strEnglish
TEXBOX2 named strFrench

My code:
<%
strEnglish=Request.Form("strEnglish")
strFrench=Request.Form("strFrench")

Select Case

Then I have no idea how to go from here, because I have 2 input textboxes to follow.
I found this example but I do not know how to apply it to my situation as I have to folow 2 textbox entries.

<%
UserName=request.form("UserName")
Select Case UserName
Case "Kathi"
Msg = "You deserve a break. Take the day off!"
Case "JD","Anne"
Msg = "Don''t forget to call Kathi today!"
Case Else
Msg = "Do I know you?"
End Select
response.write Msg
%>

Can someone please help me out, a known tutorial, perhaps an example or just plain good ole help please??

Thanks in advance,

~Newbie



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

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