繁体   English   中英

经典ASP中的动态变量

[英]Dynamic variables in Classic ASP

我想知道链接中动态变量的确切代码是什么,并通过If和If else的条件进行设置。

假设我有default.asp?variable = value&string = number链接

我该如何使用条件术语对其进行编码,使其进入我的页面。 (不确定我的代码是否正确)

<%
DIM value = something
If blah-blah then
 [asp code here]
else if blah-blah then
 [another asp code here]
end if
%>

我必须在If和Else If上匹配一个动态值,诸如此类。 提前致谢...

我将假设您的问题与ASP经典有关,并且您将要处理:

  • default.asp?cmd = add&x = 5&y = 4
  • default.asp?cmd = mult&x = 5&y = 4

并且,您分别希望输出为

  • 答案是9
  • 答案是20

为此,ASP类似于:

<html>
<head>
<title>simple asp</title>
</head>
<body>
<%
Dim cmd, x, y
cmd = Request.QueryString("cmd")
x = CDbl(Request.QueryString("x"))
y = CDbl(Request.QueryString("y"))
Select Case cmd
Case "add"
  Response.Write("Answer is " & (x + y))
Case "mult"
  Response.Write("Answer is " & (x * y))
Case Else
  Response.Write("Please supply a valid cmd")
End Select
%>
</body>
</html>

从这行代码中获得想法

<%
Set udrmcatgry=TheDB.Execute("SELECT * FROM rmcatgry ORDER BY sl asc")
Do while Not udrmcatgry.eof=true 
myqsl=udrmcatgry("sl")
TheDB.Execute "Update `rmcatgry` set   catnme`='"&request.form(""+myqsl+"")&"' where sl='"&myqsl&"' "
udrmcatgry.MoveNext         
Loop
%>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM