Mixed ASP & .NET app: SQL Connection Issues

Last post 06-08-2009 1:27 PM by AceCorban. 2 replies.

Sort Posts:

  • Mixed ASP & .NET app: SQL Connection Issues

    06-08-2009, 1:12 PM
    • Contributor
      5,393 point Contributor
    • AceCorban
    • Member since 08-23-2007, 11:43 AM
    • Monterey, CA
    • Posts 1,049
    We migrated a series of apps to different servers, some of which were developed before I showed up.  The developer of one in particular is out of town, so I have to fix it.  I'm getting the following error:

    "SQL Server does not exist or access denied."

    No sweat, I've seen this error a thousand times before, it is most likely a connection string issue, user login issue, remote connections, or mixed authentication mode issue.  So I run through the standard checklist of troubleshooting, nothing fixes the issue.  Then I realize that logging into the application works (so I can connect to the SQL Server then, but not later in the app).  Figuring maybe there is a connection string hardcoded somewhere in the broken piece, I come to discover that the broken piece is classic ASP, whereas the functional piece is .NET.

     

    //connStr is pulled from web.config:
    //"provider=SQLOLEDB; server=myServer; database=myDB; uid=myUID; pwd=myPwd;"
    conn = New OleDbConnection(connStr)
    conn.Open
    //do a query
      

    That code works.  This throws an exception:

     

    conn = Server.CreateObject('ADODB.Connection')
    rs = Server.CreateObject('ADODB.Recordset')
    conn.open("provider=SQLOLEDB; server=myServer; database=myDB; uid=myUID; pwd=myPwd;")
    //yeah, the connStr is hardcoded...dont ask me,
    //but it DOES match the connStr in the functional piece
    
    
     

    So the connection strings match, but one works, one doesn't.  Is there something I'm missing?  Some difference between classic ASP and .NET perhaps that could cause this disparity?  The only difference I see is .NET is using an OleDBConnection object and classic ASP is using a server created object by the name of "ADODB.Connection".  Thoughts?

    I never lose, some people are just better than me at winning.
  • Re: Mixed ASP & .NET app: SQL Connection Issues

    06-08-2009, 1:24 PM
    • Contributor
      4,611 point Contributor
    • Nemesis116
    • Member since 09-25-2008, 6:09 AM
    • Geel
    • Posts 919

    I think you will get better answers in the "Migrating Classic ASP to ASP.NET" forum here.

    Maybe an admin should move your post x)

    Jef Claes
    ~~~~~~~~~~


    Visit my blog
    Let's Twit!
  • Re: Mixed ASP & .NET app: SQL Connection Issues

    06-08-2009, 1:27 PM
    • Contributor
      5,393 point Contributor
    • AceCorban
    • Member since 08-23-2007, 11:43 AM
    • Monterey, CA
    • Posts 1,049

    Thanks for the tip.  I will make a copy there since I also believe unanswered posts get more views, and I'd like to give my post a chance to be seen.

    I never lose, some people are just better than me at winning.
Page 1 of 1 (3 items)