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
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 = "&mazeyIF(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
rs.close
conn.close
Else
rs.close
conn.close
returnErr "mazey"
response.end
End if
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
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
Else
conn.close
returnErr "mazey"
response.end
End if
End if
End If
Error:
Modify:
ADD conn.close After IF...ELSE...
Error:
Modify:
ADD conn.close After IF...ELSE...
GitHub: https://github.com/mazeyqian
Blog: https://blog.mazey.net/
Blog: https://blog.mazey.net/