zcnvnv 发表于 2008-10-13 18:18

怎样判断select查询是否为空?

如题.

nicechlk 发表于 2008-10-13 18:48

select * from [表名] where 条件表达式
if rs.eof and rs.bof then
  response.write "<script language='javascript'>"
  response.write "alert('对不起,没有您要查询的结果!');"
  response.write "location.history.go(-1);"
  response.write "</script>"
end if

zcnvnv 发表于 2008-10-13 19:02

我本来也是这样想的,但是...:

[tk10]

代码
        set rs=server.createobject("adodb.recordset")
        sql="select tmp_top from Article_message where kind='"&kind&"' and id="&id&" order by tmp_top desc"
        rs.open sql,conn,1,3
        if rs.eof and rs.bof then
        tmp_top=1
        else
        tmp_top=rs("tmp_top")+1
        end if

提示:


ADODB.Recordset '800a0bcd'

BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。

\wwwroot\article_message.asp, line 109

[[it] 本帖最后由 zcnvnv 于 2008-10-13 19:05 编辑 [/it]]

multiple1902 发表于 2008-10-13 19:19

把and改成or试试。

页: [1]

编程论坛