<%@ Language=VBScript %> Switch Query Test

Switch Query Test

<% On Error Resume Next Dim switchid, rs, switchname, modelid, serialnumber, ipaddress, description, maptop, mapleft, isactive, vendorname, modelnumber switchid = 5411 Dim strSQL strSQL = "SELECT mac.machineid, mac.alias AS switchname, mac.modelnumberid AS modelid, " & _ "mac.serialnumber, mac.machinenotes AS description, mac.maptop, mac.mapleft, mac.isactive, " & _ "m.modelnumber, v.vendor, c.address AS ipaddress " & _ "FROM machines mac " & _ "LEFT JOIN models m ON mac.modelnumberid = m.modelnumberid " & _ "LEFT JOIN vendors v ON m.vendorid = v.vendorid " & _ "LEFT JOIN communications c ON mac.machineid = c.machineid AND c.isprimary = 1 AND c.comstypeid = 1 " & _ "WHERE mac.machineid = " & switchid & " AND mac.machinetypeid = 31" Set rs = objConn.Execute(strSQL) If Err.Number <> 0 Then Response.Write("

Query ERROR: " & Server.HTMLEncode(Err.Description) & "

") ElseIf rs.EOF Then Response.Write("

Switch not found

") Else ' Apply NULL handling If Not IsNull(rs("switchname")) Then switchname = rs("switchname") Else switchname = "" If Not IsNull(rs("modelid")) Then modelid = rs("modelid") Else modelid = "" If Not IsNull(rs("serialnumber")) Then serialnumber = rs("serialnumber") Else serialnumber = "" If Not IsNull(rs("ipaddress")) Then ipaddress = rs("ipaddress") Else ipaddress = "" If Not IsNull(rs("description")) Then description = rs("description") Else description = "" If Not IsNull(rs("maptop")) Then maptop = rs("maptop") Else maptop = "" If Not IsNull(rs("mapleft")) Then mapleft = rs("mapleft") Else mapleft = "" If Not IsNull(rs("isactive")) Then isactive = rs("isactive") Else isactive = 1 If Not IsNull(rs("vendor")) Then vendorname = rs("vendor") Else vendorname = "" If Not IsNull(rs("modelnumber")) Then modelnumber = rs("modelnumber") Else modelnumber = "" Response.Write("

SUCCESS! Data loaded:

") Response.Write("") End If rs.Close Set rs = Nothing objConn.Close %>