• schleep (2/27/2014)


    Well if I'm understanding this -- and to be honest, I'm on very thin ice -- I can't check the state of the connection in my original code as suggested by batesview

    conStr="Provider=sqloledb;Data Source=<SQLServer2008>;Initial Catalog=<mydb>;Integrated Security=SSPI"

    Set cmdObj=createobject("adodb.command")

    On Error Resume Next

    ' if cmdObj.State = 1 then

    With cmdObj

    .activeconnection=conStr

    --blah

    End with

    because I haven't actually opened a connection -- only instantiated a command object.

    Are you suggesting that, from your example, I could check the state of the oConn object (not the command object), since that one is established before the command is executed?

    I'll follow up on that if I see more 3709's.

    Thanks folks.

    Yes exactly. Using my code you would have an explicit connection which would let you check of the connection object. 😉

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/