ASP DO WHILE 判断的问题

来源:百度知道 编辑:UC知道 时间:2024/05/31 17:41:39
判断31天里面哪天有记录,有的话输出yes无输出no
看看以下代码哪里出问题了,全部都输出no?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM article"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<

copy到你的body里,建议不要用DW写SQL,光给你看他的MM_都叫你眼花缭乱
<%
dim rs
Set rs= Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM article"
rs.Open sql,conn,1,3
rs_Rows = 0
rs_Rows = -1
rs_index = 0
rs_Rows = rs_Rows + rs_Rows
for i=1 to 31
flag=0
do while not rs.eof and rs_Rows <> 0
if rs("year")=2009 and rs("month")=5 and rs("day")=i then
flag=1
exit do
end if
rs_index=rs_index+1
rs_Rows=rs_Rows-1
rs.movenext()
loop
if flag=1 then response.write "yes<br>" else response.write "no<br>" end if
next
rs.Close()
Set rs = Nothing
%>

简单的几句代码被DW写成这么复杂...OTZ

看不懂写的复杂,
if not rs.eof and not rs.bof then这样吧