Click here to Skip to main content
16,019,876 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am getting the following error ODBC-Failed to connect to 'Databasename'. How to solve this issue? Please help someone......

What I have tried:

I have created the connection between ODBC and Sql server. The Sql server table imported into MS Access. But it is not solved the problem.
Posted
Updated 30-Sep-20 2:25am
Comments
CHill60 30-Sep-20 10:35am    
I believe that you are using VB6 - am I right? Share the code that is generating this error

1 solution

Why are you using ODBC to connect to SQL Server?
Why are you exporting an SQL Table to Access?

Just use the SqlConnection, SqlCommand, SqlDataReader, and SqlDataAdapter classes to connect to your SQL Sever DB directly: you'll need a connection string, but it'll be pretty basic:
Data Source=<SQL server ID name>;Initial Catalog=<Database name>;User Id=XXX;Password=XXX
For example:
Data Source=GRDESK\\SQLEXPRESS;Initial Catalog=VideoMaster;User Id=XXX;Password=XXX
 
Share this answer
 
Comments
CHill60 30-Sep-20 10:35am    
Based on earlier posts I think the OP is still using VB6 :-(
OriginalGriff 30-Sep-20 10:37am    
To write new apps? In 2020? It was probably abandoned before he was born! :OMG:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900