Connection Reuse

  • I want to repeatedly reuse a connection, but cannot get it work, any ideas?

    ---------THIS CODE WORKS --------------

    set LogConn = CreateObject("ADODB.Connection")

    LogConn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=(local)"

    LogSQL = "INSERT INTO MIGRATIONLOG (...) VALUES (...)"

    logConn.Execute(LogSQL)

    LogConn.Close

    set LogConn = nothing

    -------------THIS CODE DOES NOT WORK ------------

    set pkg = DTSGlobalVariables.Parent

    set LogConn = pkg.Connections("master")

    LogSQL = "INSERT INTO MIGRATIONLOG (...) VALUES (...)"

    LogConn.Execute(LogSQL) - FAILS HERE

  • Variable not in scope or not opened?

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply