?
Solved

oledb connection to SQL Server not working

Posted on 2010-08-13
3
Medium Priority
?
438 Views
Last Modified: 2013-11-27
In Access 2007, (trying to access SQL Server) I have the following code:
    Dim cn As New ADODB.Connection
    Dim strCN As String
    strCN = "Provider=SQLOLEDB;Server=10.10.10.1;" & _
             "Initial Catalog='Websites';User ID=sa;PWD=xxxxxxxx"

    cn.CommandTimeout = 3000000
    cn.Open

This gives the following error:
[Microsoft][ODBSC Driver Manager] Data Source Name not found and no default driver specified
0
Comment
Question by:jking1234
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 24

Expert Comment

by:Bitsqueezer
ID: 33430247
Hi,

I would recommend to use the SQLNCLI driver instead (must be installed on Windows XP machines, not available by default).

Moreover you should make sure that TCP/IP is enabled on the SQL Server if you access the server by IP address.
You can find examples of connection strings here:
http://www.connectionstrings.com/sql-server-2005#p2

There is also an example of how to use the IP address.

And I hope that this string was only an example and you don't really try to connect to the SQL Server using the "sa" account...:-)

Cheers,

Christian
0
 

Accepted Solution

by:
jking1234 earned 0 total points
ID: 33544602
fixed it myself
0
 

Author Comment

by:jking1234
ID: 33544625
zzz
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question