Click here to Skip to main content
15,908,842 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I'm testing ODBC connection using VB.NET 2008.
Fisrt I have created, with ODBC manager, an User ODBC connection named 'XXX' that works fine (all test passed).

In my program I set the ConnectionString so: myODBC.Connectionstring="ODBC=XXX;"
when I try to open the connection VB goes in error :

SQL Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
SQL Scriptline:
SQL State:IM002


I'm confused what is the mistake?

Thanks

additional information copied from non-solution below
At last I looked in the system registry (HKEY_CURRENT_USER\Software\ODBC\ODBC.Ini\XXX)
and the data are valid the name of the ODBC is the right one , I did the test with both a System DNS , but I have same result.
I'm working on PC where is installed XPPro 32bit.
The DNS appears under User DNS
Help me
Posted
Updated 15-Oct-14 11:10am
v2

Seems the DSN is not created properly. Can you go to Run> then paste odbcad32.exe
Can you see your ODBC connection there. If yes, under which tab?

Can you test the connection there if it is connecting (this step is not needed for you if the ODBC name is there)
 
Share this answer
 
The connection string "ODBC=XXX" is not valid. It should be "DSN=XXX".

If your data source requires credentials, you will need to specify those as well: "DSN=XXX;Uid=username;Pwd=password".

http://www.connectionstrings.com/dsn/[^]
 
Share this answer
 
Thanks, it's works fine, I'm really a fool to not having noticed the error
 
Share this answer
 

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