asp 中用SQL 语句先判断数据库中某一个表是否为空应该怎么写?

来源:百度知道 编辑:UC知道 时间:2024/05/12 10:30:13
strSql="select count(*) from V_news
set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSql, my_Conn, adOpenKeyset, dLockOptimistic, adCmdText
if rs.EOF=0 then
……
else
……
end if
set rs = nothing '清空rs值

这样是不是就可以了?

sql="select count(*) as cc from V_news"
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs("cc")=0 then
response.write"V_news中没有数据"
end if
rs.close
set rs=nothing

if rs.eof and rs.bof then
...

rs.recordcount = 0