sql:if(select count(*) from table1)= 0 then
我想用到程序中作为判断的条件:if ....then

解决方案 »

  1.   

    不行的,你这样吧:
    rs.open "select count(*) from table1",...
    if rs.eof and rs.bof then
    else
        if not isnull(rs(0)) then
           if rs(0)<>0 then
              '这里做不等于0的事
           end if
        end if
    end if
    rs.close
    ...^_^
      

  2.   

    rs.open "select isnull(count(*),0) as 总数 from table1",...
        if rs("总数")=0 then
              '这里做等于0的事
        end ifrs.close
      

  3.   

    rs.open "select * from table",cn
    if rs.recordcount<=0 then
    .................
    endif
      

  4.   

    我其实就是这么做的。
    但我觉得有点麻烦,而且那么好的sql在那,用不着,真可惜。