title: Adding Odbc reference to my application
body: <p>I am using Visual Studio 2013 to connect to MySql database using ODBC. I am unable to find reference for System.Data.Odbc in my project. I keep on getting this exception</p>
  
  <pre><code> System.Data.Odbc.OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
     at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
     at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
     at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
     at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
     at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningCo
  nnection, DbConnectionOptions userOptions)
     at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
     at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, Db
  ConnectionInternal&amp; connection)
     at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions use
  rOptions)
     at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
     at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
     at System.Data.Odbc.OdbcConnection.Open()
     at DbConnection.Program.Main(String[] args) in C:\Users\ankur_agrawal\AppData\Local\Temporary Projects\DbConnection\Program.cs:line 17System.InvalidOperationException: ExecuteReader requires an ope
  n and available Connection. The connection's current state is closed.
     at System.Data.Odbc.OdbcConnection.SetStateExecuting(String method, OdbcTransaction transaction)
     at System.Data.Odbc.OdbcCommand.ValidateConnectionAndTransaction(String method)
     at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
     at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
     at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
  </code></pre>
  
  <p>The code I have written is </p>
  
  <pre><code>namespace DB
  {
      class Program
      {
          static void Main(string[] args)
          {
              try
              {
                  Program p = new Program();
                  OdbcConnection con = new OdbcConnection("DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;USER=root;PASSWORD=root;DATABASE=employee");
                  OdbcCommand cmd = new OdbcCommand("select * from emplpoyee", con);
                  con.Open();
                  OdbcDataReader reader = cmd.ExecuteReader();
                  reader.Close();
              }
  
              catch (Exception e)
              {
                  Console.Write(e);
              }
  
              Console.ReadKey();
          }
      }
  }
  </code></pre>