« Previous Next »

Thread: DB Connection passed back from a function is unusable

Last post 04-01-2009 7:36 AM by gssit. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 03-31-2009, 3:50 PM

    • gssit
    • Not Ranked
    • Joined on 03-31-2009, 3:34 PM
    • Posts 2

    DB Connection passed back from a function is unusable

    All...

    I've been searching for hours and am at my wits end.  We're simply trying to get a legacy app running for a client on IIS 7 - our transition to .NET for this piece isn't yet complete.

     I have the same four lines of ADODB.Connection code in my initial login page (not in a function) and the connection works just fine.  On all subsequent pages, the connection is returned from a "function" and no matter what I do - I get a "Login failed" error.  It appears, for some reason, the connection handle coming back from the function isn't valid - although it's worked for many, many years with IIS 6.  My gut tells me this is some obscure permissions thing dealing with scope or something.  Any help would be GREATLY appreciated.

    Code, when in each ASP page works:

    dim oConn
    set oConn = server.CreateObject("ADODB.Connection")
    with oConn
        .ConnectionString = Session("ConnectString")
        .Open
    end with 

    ...

    oRSLogin.Open userSql, oConn ' NO ERROR - Works

     

    Code, when in a function that DOES NOT work


    function GetUserConn()
        set oConn = server.CreateObject("ADODB.Connection")
        oConn.ConnectionTimeout = 900
        with oConn
            .ConnectionString = session("connectString")
            .Open
        end with
        GetUserConn = oConn
    end function

    oConn = GetUserConn()

    oSRList.Open sSRSql, oConn     ' THIS IS WHERE I GET AN ERROR

     

    Thanks for any help!

  • 04-01-2009, 4:53 AM In reply to

    Re: DB Connection passed back from a function is unusable


    Try changing your application pool from integrated to classic mode.  It could be something with the way the new app pool pipeline is operating.

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 04-01-2009, 7:36 AM In reply to

    • gssit
    • Not Ranked
    • Joined on 03-31-2009, 3:34 PM
    • Posts 2

    Re: DB Connection passed back from a function is unusable

     I appreciate the suggestion.  I stumbled across that early in the day yesterday and made that change - to no avail.  Seemed like a logical option to change, but no dice.

Page 1 of 1 (3 items)
Microsoft Communities