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:

ASP查询数据RS转换成COMMAND



Modify:

ADD conn.close After IF...ELSE... 

上一篇:Kinect用体感来实现UI控件的点击


下一篇:1005 - Rooks(规律)