David Crowell :: Occasional Thoughts

Some Dumb Tech Guy

  Home :: Contact :: Syndication  :: Login
  27 Posts :: 0 Articles :: 53 Comments

Archives

Post Categories

About Me

Archived Software

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?

posted on Monday, July 02, 2007 12:57 PM