请问,asp的if函数怎么使用?
呵呵~我是朋友介绍这里来的!
所以现在遇到if函数我不会,请教一下大家!
我现在遇到一段代码,但是老是提示语句错误!
晕~
代码是:if instr(url,"article")>0 then
Sql="select title from [sms] Where ID="&ID
elseif
Sql="select name from [wjfile] where soft=1"
elseif
Sql="select name from [wsfile] Where ID="&ID
elseif
Sql="select name from [wjfile] where picsc=2"
end if
这样加,应该没错啊!
怎么会错误呢?
晕~
大家能帮我解决一下嘛?
还有那里有asp if语句教程呢?我去也顺便去学习下! --------------------编程问答-------------------- http://www.bianceng.cn/webkf/asp/200802/7401.htm
--------------------编程问答-------------------- if instr(url,"article")>0 then
Sql="select title from [sms] Where ID="&ID
elseif 其他條件1,如xx=1
Sql="select name from [wjfile] where soft=1"
elseif 其他條件1,如xx=2
Sql="select name from [wsfile] Where ID="&ID
else
Sql="select name from [wjfile] where picsc=2"
end if --------------------编程问答-------------------- 回2楼,不行啊!
提示如下:
Microsoft VBScript 编译器错误 错误 '800a03ea'
语法错误
/getbook.asp,行 40
elseif
------^ --------------------编程问答-------------------- 还是给全部代码吧:
<!-- #include file="Inc/Inc.asp" -->
<!-- #include file="Inc/Function.asp" -->
<%'============================================================
' Copyright 2007-09 燃点真情. All Rights Reserved.
' Last Update: 2008-3-22 13:28
' ADD:wap.nowtx.cn
' E-Mail: xivn@163.com QQ:531233814
'============================================================
%>
<%call head()%>
<card title='收藏书签'><p>
<%
'-------A登录信息
if myid=0 then
Response.write "<a href='login.asp?url="&Replace(Replace(R_url(),"sid=","o="),"sid=","o=")&"'>请您先登陆...</a>"& chr(13)
Response.write "<br/><anchor><prev/>返回</anchor>" & chr(13)
Response.write "</p></card></wml>"
Response.end
end if
'==========得到URL
function ForUrl(str)
ForUrl = str
ForUrl = Replace(Replace(Replace(ForUrl,"-w-","?"),"-a-","&"),"-d-","=")
end function
dim sql,id,url,ids,cid
id=trim(request("id"))
url=trim(request("url"))
ids=trim(request("class"))
if ID = "" or IsNumeric(ID) = False then
Call Error("ID错误!")
end if
dim linkname,linkurl
set Rs=Server.CreateObject("ADODB.Recordset")
if instr(url,"article")>0 then
Sql="select title from [sms] Where ID="&ID
elseif
Sql="select name from [wjfile] where soft=1"
elseif
Sql="select name from [wsfile] Where ID="&ID
else
Sql="select name from [wjfile] where picsc=2"
end if
Rs.open Sql,conn,1,1
If rs.eof Then
Call Error("不存在的记录!")
end if
if instr(url,"article")>0 then
linkname=rs("title")
cid=2
elseif
linkname=rs("name")
cid=3
else if
linkname=rs("name")
cid=4
else if
linkname=rs("name")
cid=5
end if
rs.close
set rs=nothing
linkurl=ForUrl(url)&"&sid=[sid]"
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from [mysq] where urlsq='"&linkurl&"' and cid="&cid&" and ids="&myid
rs.open sql,conn,1,2
if rs.eof then
rs.addnew
rs("title")=linkname
rs("urlsq")=linkurl
rs("ids")=myid
rs("cid")=cid
rs("gxtime")=now()
rs.update
response.write"成功将该书签收藏<br/>"
Else
response.write"该书签已经在您的收藏中了<br/>"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
if instr(url,"article")>0 then
response.write"<a href='article.asp?id="&id&"&class="&ids&"&sid="&sid&"'>返回上级</a>"
else
response.write"<a href='picview.asp?id="&id&"&class="&ids&"&sid="&sid&"'>返回上级</a>"
end if
response.write"<br/><a href='/bbs/mybook.asp?sid="&sid&"'>[我的书签]</a><br/>"
%>
</p>
</card>
</wml> --------------------编程问答-------------------- 呜呜呜..
第一次,来这里都没人帮我! --------------------编程问答--------------------
是你走错地方了,这是asp.net版,不是asp版,asp.net和asp根本就不是一回事,我易做图年前也搞asp,asp.net一出来我就转asp.net了,再没接触asp,asp技术现在很少有人用了。 --------------------编程问答--------------------
可是我根本就找不到asp版啊! --------------------编程问答--------------------
看CSDN论坛左边的导航菜单:
+Web开发
ASP
补充:.NET技术 , ASP.NET