Fix IIf() runtime bug in updatedevicedirect.asp
VBScript does not have an IIf() function. Replaced 6 IIf() calls with proper If-Then-Else variable preparation for network interface parameter handling (ip1/mac1, ip2/mac2, ip3/mac3). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -444,6 +444,11 @@
|
|||||||
|
|
||||||
' Interface 1 (Primary)
|
' Interface 1 (Primary)
|
||||||
If ip1 <> "" Or mac1 <> "" Then
|
If ip1 <> "" Or mac1 <> "" Then
|
||||||
|
' Prepare parameter values (VBScript has no IIf)
|
||||||
|
Dim paramIp1, paramMac1
|
||||||
|
If ip1 <> "" Then paramIp1 = ip1 Else paramIp1 = Null
|
||||||
|
If mac1 <> "" Then paramMac1 = mac1 Else paramMac1 = Null
|
||||||
|
|
||||||
Dim cmdComm1
|
Dim cmdComm1
|
||||||
Set cmdComm1 = Server.CreateObject("ADODB.Command")
|
Set cmdComm1 = Server.CreateObject("ADODB.Command")
|
||||||
cmdComm1.ActiveConnection = objConn
|
cmdComm1.ActiveConnection = objConn
|
||||||
@@ -451,8 +456,8 @@
|
|||||||
cmdComm1.CommandType = 1
|
cmdComm1.CommandType = 1
|
||||||
cmdComm1.Parameters.Append cmdComm1.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
cmdComm1.Parameters.Append cmdComm1.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
||||||
cmdComm1.Parameters.Append cmdComm1.CreateParameter("@comstypeid", 3, 1, , comstypeid)
|
cmdComm1.Parameters.Append cmdComm1.CreateParameter("@comstypeid", 3, 1, , comstypeid)
|
||||||
cmdComm1.Parameters.Append cmdComm1.CreateParameter("@address", 200, 1, 50, IIf(ip1 <> "", ip1, Null))
|
cmdComm1.Parameters.Append cmdComm1.CreateParameter("@address", 200, 1, 50, paramIp1)
|
||||||
cmdComm1.Parameters.Append cmdComm1.CreateParameter("@macaddress", 200, 1, 50, IIf(mac1 <> "", mac1, Null))
|
cmdComm1.Parameters.Append cmdComm1.CreateParameter("@macaddress", 200, 1, 50, paramMac1)
|
||||||
cmdComm1.Parameters.Append cmdComm1.CreateParameter("@interfacename", 200, 1, 50, "Interface 1")
|
cmdComm1.Parameters.Append cmdComm1.CreateParameter("@interfacename", 200, 1, 50, "Interface 1")
|
||||||
|
|
||||||
On Error Resume Next
|
On Error Resume Next
|
||||||
@@ -463,6 +468,11 @@
|
|||||||
|
|
||||||
' Interface 2 (Optional)
|
' Interface 2 (Optional)
|
||||||
If ip2 <> "" Or mac2 <> "" Then
|
If ip2 <> "" Or mac2 <> "" Then
|
||||||
|
' Prepare parameter values (VBScript has no IIf)
|
||||||
|
Dim paramIp2, paramMac2
|
||||||
|
If ip2 <> "" Then paramIp2 = ip2 Else paramIp2 = Null
|
||||||
|
If mac2 <> "" Then paramMac2 = mac2 Else paramMac2 = Null
|
||||||
|
|
||||||
Dim cmdComm2
|
Dim cmdComm2
|
||||||
Set cmdComm2 = Server.CreateObject("ADODB.Command")
|
Set cmdComm2 = Server.CreateObject("ADODB.Command")
|
||||||
cmdComm2.ActiveConnection = objConn
|
cmdComm2.ActiveConnection = objConn
|
||||||
@@ -470,8 +480,8 @@
|
|||||||
cmdComm2.CommandType = 1
|
cmdComm2.CommandType = 1
|
||||||
cmdComm2.Parameters.Append cmdComm2.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
cmdComm2.Parameters.Append cmdComm2.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
||||||
cmdComm2.Parameters.Append cmdComm2.CreateParameter("@comstypeid", 3, 1, , comstypeid)
|
cmdComm2.Parameters.Append cmdComm2.CreateParameter("@comstypeid", 3, 1, , comstypeid)
|
||||||
cmdComm2.Parameters.Append cmdComm2.CreateParameter("@address", 200, 1, 50, IIf(ip2 <> "", ip2, Null))
|
cmdComm2.Parameters.Append cmdComm2.CreateParameter("@address", 200, 1, 50, paramIp2)
|
||||||
cmdComm2.Parameters.Append cmdComm2.CreateParameter("@macaddress", 200, 1, 50, IIf(mac2 <> "", mac2, Null))
|
cmdComm2.Parameters.Append cmdComm2.CreateParameter("@macaddress", 200, 1, 50, paramMac2)
|
||||||
cmdComm2.Parameters.Append cmdComm2.CreateParameter("@interfacename", 200, 1, 50, "Interface 2")
|
cmdComm2.Parameters.Append cmdComm2.CreateParameter("@interfacename", 200, 1, 50, "Interface 2")
|
||||||
|
|
||||||
On Error Resume Next
|
On Error Resume Next
|
||||||
@@ -482,6 +492,11 @@
|
|||||||
|
|
||||||
' Interface 3 (Optional)
|
' Interface 3 (Optional)
|
||||||
If ip3 <> "" Or mac3 <> "" Then
|
If ip3 <> "" Or mac3 <> "" Then
|
||||||
|
' Prepare parameter values (VBScript has no IIf)
|
||||||
|
Dim paramIp3, paramMac3
|
||||||
|
If ip3 <> "" Then paramIp3 = ip3 Else paramIp3 = Null
|
||||||
|
If mac3 <> "" Then paramMac3 = mac3 Else paramMac3 = Null
|
||||||
|
|
||||||
Dim cmdComm3
|
Dim cmdComm3
|
||||||
Set cmdComm3 = Server.CreateObject("ADODB.Command")
|
Set cmdComm3 = Server.CreateObject("ADODB.Command")
|
||||||
cmdComm3.ActiveConnection = objConn
|
cmdComm3.ActiveConnection = objConn
|
||||||
@@ -489,8 +504,8 @@
|
|||||||
cmdComm3.CommandType = 1
|
cmdComm3.CommandType = 1
|
||||||
cmdComm3.Parameters.Append cmdComm3.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
cmdComm3.Parameters.Append cmdComm3.CreateParameter("@machineid", 3, 1, , CLng(machineid))
|
||||||
cmdComm3.Parameters.Append cmdComm3.CreateParameter("@comstypeid", 3, 1, , comstypeid)
|
cmdComm3.Parameters.Append cmdComm3.CreateParameter("@comstypeid", 3, 1, , comstypeid)
|
||||||
cmdComm3.Parameters.Append cmdComm3.CreateParameter("@address", 200, 1, 50, IIf(ip3 <> "", ip3, Null))
|
cmdComm3.Parameters.Append cmdComm3.CreateParameter("@address", 200, 1, 50, paramIp3)
|
||||||
cmdComm3.Parameters.Append cmdComm3.CreateParameter("@macaddress", 200, 1, 50, IIf(mac3 <> "", mac3, Null))
|
cmdComm3.Parameters.Append cmdComm3.CreateParameter("@macaddress", 200, 1, 50, paramMac3)
|
||||||
cmdComm3.Parameters.Append cmdComm3.CreateParameter("@interfacename", 200, 1, 50, "Interface 3")
|
cmdComm3.Parameters.Append cmdComm3.CreateParameter("@interfacename", 200, 1, 50, "Interface 3")
|
||||||
|
|
||||||
On Error Resume Next
|
On Error Resume Next
|
||||||
|
|||||||
Reference in New Issue
Block a user