帮忙,asp if else语句嵌套问题

来源:百度知道 编辑:UC知道 时间:2024/05/23 00:20:01
if one = a Then
sql1 = "update num1 set sA = sA + 1"
conn.execute(sql1)
else if one = b Then
sq2 = "update num1 set sB = sB + 1"
conn.execute(sql2)
else if one = c Then
sql3 = "update num1 set sC = sC + 1"
conn.execute(sql3)
end if
end if
end if

无法执行第2个以下的sql语句
one是单选框,a,b,c是value值,选择以后,数据库加一时,只在第一项加,即a选项1

服务器段类似
-------------------------
Dim strfeildName

If request.Form("one") = "a" then
strfeildName = "sA"
Else If request.Form("one") = "b" Then
strfeildName = "sB"
Else If request.Form("one") = "c" then
strfeildName = "sC"
End if

sql = "update num1 set " & strfeildName & " = " strfeildName & "+ 1"
conn.execute(sql)

---------------------------
客户端类似
<form name="form1">
<select name=one onchange="document.forms.form1.submit()"></select>
<form>

字符要用""括起来.条件语句了可改进.
代码改正如下;

if one = "a" Then
sql1 = "update num1 set sA = sA + 1"
conn.execute(sql1)
elseif one = "b" Then
sq2 = "update num1 set sB = sB + 1"
conn.execut