所以我在SQL中有这个查询。我知道如果记录是记录集中的最后一个记录:
sql = SELECT * FROM table WHERE RID = 27
Set rs=Conn.Execute(sql)
If not rs.EOF Then
iID = rs("RID")
If iID = LAST Then response.write ("this is last record") End If
End If
Conn.Close
Set Conn = Nothing
有什么办法吗?
答案 0 :(得分:3)
不确定为什么你需要这样做,但你可以这样做:
sql = SELECT * FROM table WHERE RID = 27
Set rs=Conn.Execute(sql)
If not rs.EOF Then
rs.MoveNext
If rs.EOF Then
response.write ("this is last record")
End If
End If
Conn.Close
Set Conn = Nothing
考虑到你的查询的性质,看起来你只会得到1行,所以这看起来毫无意义。
答案 1 :(得分:0)
<%
sql = "SELECT MAX(RID) FROM table "
Set rs=Conn.Execute(sql)
isLast = "no records"
If not rs.BOF Then
if rs(0) = 27 then '' 27 or somone else for your taste
ifLast = "last record"
else
ifLast = "not last record"
end if
End If
Response.Write isLast
Conn.Close
Set Conn = Nothing
%>