Classic ASP中的动态变量

时间:2012-02-07 00:30:55

标签: asp-classic

我想知道链接的动态变量的确切代码是什么,并通过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,类似的东西。 提前谢谢......

2 个答案:

答案 0 :(得分:4)

我将假设您的问题是关于ASP经典并且您将要处理:

  • 的default.asp CMD =添加&安培; X = 5&安培; Y = 4
  • 的default.asp CMD =多重峰和安培; 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>

答案 1 :(得分:1)

从这行代码中获取想法

<%
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
%>