While debugging some legacy VB6 code, I ran across the following gem:
If Not adoConn Is Nothing Then Set adoConn = Nothing
Set adoConn = CreateObject("ADODB.Connection")
adoConn.Open strConnection
If Not adoCmd Is Nothing Then Set adoCmd = Nothing
Set adoCmd = CreateObject("ADODB.Command")
Set adoCmd.ActiveConnection = adoConn
adoCmd.CommandType = adCmdText
How many problems can you find with this code?