ASP查询数据RS转换成COMMAND

RS版本:
IF(troubleCatalog="1" or troubleCatalog="2" or troubleCatalog="3" or troubleCatalog="4" or troubleCatalog="5" or troubleCatalog="6" or troubleCatalog="7" or troubleCatalog="8" or troubleCatalog="9" or troubleCatalog="10" or troubleCatalog="11" or troubleCatalog="12" or troubleCatalog="13" or troubleCatalog="164") Then
    sql="select dom_name from domainlist where dom_name='"&productName&"' and d_owner = "&mazey
    conn.open
    rs.open sql,conn,1,1 
    If Not rs.eof Then
        rs.close
        conn.close
    Else
        rs.close 
        conn.close
        returnErr "mazey"
        response.end
    End if
End If 
 
COMMAND版本:
IF(troubleCatalog="1" or troubleCatalog="2" or troubleCatalog="3" or troubleCatalog="4" or troubleCatalog="5" or troubleCatalog="6" or troubleCatalog="7" or troubleCatalog="8" or troubleCatalog="9" or troubleCatalog="10" or troubleCatalog="11" or troubleCatalog="12" or troubleCatalog="13" or troubleCatalog="164") Then
    sql="select dom_name from domainlist where dom_name='"&productName&"' and d_owner = "&mazey
    conn.open
    Set cmd=Server.CreateObject("adodb.Command")
    set cmd.ActiveConnection=conn
    cmd.CommandText=sql
    cmd.CommandType=1
    cmd.Parameters.Append cmd.CreateParameter("dom_name",200,1,64,dom_name)
    set rs=cmd.execute()
    set cmd.ActiveConnection=nothing
    set cmd=nothing
    If Not rs.eof Then
        conn.close
    Else
        conn.close
        returnErr "mazey"
        response.end
    End if
End If

Error:
图片

Modify:
ADD conn.close After IF...ELSE... 


 

posted @ 2017-03-04 22:55  除除  阅读(275)  评论(0编辑  收藏  举报