Question

Can't connect to ODBC database from Visual Studio 2013 Express

Please help, I have looked at HUNDREDS of tutorials online and they all say the same thing, use the data connections, select ".NET Framework Data Provider for ODBC" and.....

But I can't get past that step because there is no ".NET Framework Data Provider for ODBC" available. I have checked the multiple machine.config files on my computer and each of them have this Data Provider listed under , and there is no entry to delete as many suggest.

This person had a similar issue with VS2012Express:

https://stackoverflow.com/questions/17510532/net-framework-data-provider-for-odbc-missing-in-vs-express-2012-for-web

I am using VS2013Express

Was it helpful?

Solution

I'm not quite sure what approach you are taking, but I prefer to do it the manual way. This is a simple program that should work:

using(var connection = new OdbcConnection(ConfigurationManager.ConnectionStrings["myOdbcSource"].ToString()))
{
   connection.Open();
   var command = new OdbcCommand("select * from users", connection);
   var result = command.ExecuteReader();
   //do stuff with result.
}

My app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="myOdbcSource" connectionString="DSN=myDsn;Uid=myUsername;Pwd=;" />
  </connectionStrings>
</configuration>

Then you use the odbcad32.exe file to set up the odbc source and call it myDsn in this example. You can use either SQL Server driver or SQL Server Native Client 11.0. I think both should be available to you.

Good luck

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top