troubleshooting Question

Connect VB6 to SQL 2008

Avatar of ChadB234
ChadB234 asked on
Visual Basic ClassicMicrosoft SQL Server 2005Microsoft SQL Server 2008
4 Comments1 Solution2124 ViewsLast Modified:
I have several  programs that I've been using for years in VB6 that connect to a SQL 2000 server, I'm looking to upgrade the Db server to SQL 2008 and am having trouble connectiong to the 2008 server. Do I have to make changes to the connection string for SQL 2005/2008?

Here is my connection that im using now to connect to the SQL 2000 server:

    Dim DBNAME As String, SERVERNAME As String
   
    DBNAME = "database"                   'SUBSTITUTE YOUR DATABASE NAME HERE
    SERVERNAME = "server\instance"  'SUBSTITUTE YOUR SQL SERVER NAME HERE
   
    cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=" & DBNAME & ";Data Source=" & SERVERNAME
    cn.Open   '<---Fails when opening connection with the attached error message
   
    rs.ActiveConnection = cn
    rs.CursorLocation = adUseClient
    rs.CursorType = adOpenStatic
    rs.LockType = adLockBatchOptimistic
   
    rs.Source = "SELECT * FROM table ORDER BY lastname, firstname"
    rs.Open

It fails at the cn.open with "SQL server does not exist or access denied"
Im using integrated security and the login i'm using has dbo on the database.

Any help would be greatly appreciated!

Thanks!
ConnFail.JPG
ASKER CERTIFIED SOLUTION
3_S

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros