asp判断语句问题,急!求高手

来源:百度知道 编辑:UC知道 时间:2024/06/05 04:45:54
我想要的效果是如果接收的2个变量符合要求程序就继续往下面执行,否则提示错误信息,代码在下面,求高手帮我看看!

<%
dim name,zsbh
name=request("nam")
zsbh=request("bh")
set conn=server.Createobject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.Oledb.4.0;data source="&server.MapPath("xiaogan.mdb")
if name<>"" then
end if
str1="select * from zc where NAME='"&name&"' and ZSBH='"&zsbh&"'"
set rs=conn.Execute(str1)
%>
如果符合下面的条件就继续执行下面的程序,否则弹出警告信息
<%if rs("NAME")="&name&" And rs("ZSBH")="&zsbh&" then

<html>
........中间的就不写了!
</html>

记得前面已经答过这题了啊?

str1="select * from zc where NAME='"&name&"' and ZSBH='"&zsbh&"'"

<%if rs("NAME")="&name&" And rs("ZSBH")="&zsbh&" then

你在sql语句里已经同样的条件过滤了。
完了你又来判断?不知道你傻的还是我傻的?

看看下面是不是你想要的
<%
if rs("NAME")="&name&" And rs("ZSBH")="&zsbh&" then
%>
<html>
中间的就不写了!
</html>
<%
else
Response.Write("<script>alert('没有你要的数据!');history.go(-1)</script>")
end if
%>

<%if rs("NAME")="&name&" And rs("ZSBH")="&zsbh&" then %>
....要执行程序
<%else%>
<script>alert("警告");</script>
<%end%>

<% if rs(\"NAME\")=\"&name&\" And rs(\"ZSBH\")=\"&zsbh&\