title: is there anyway to connect to sybase from c# without having to add a ODBC DSN connection in control panel
body: <p>I am looking for a way to connect to sybase from C# without having to setup an ODBC DSN connection locally on the machine.</p>
  
  <p>Is this possible? I tried all of these different connection strings:</p>
  
  <pre><code>static private DataTable Run(string sql)
  {
      var conn = new OdbcConnection();
  
      const string CONN_STRING2 =
          "Data Source='[myServer]';Port=5020;Database=[dbName];Uid=[user];Pwd=[pwd];";
  
      const string CONN_STRING1 =
          "Provider=Sybase.ASEOLEDBProvider.2;Server Name=[myServer];Server Port Address=5020;Initial Catalog=[dbName];User ID=[user];Password=[pwd];";
  
      conn.Open();
  
      var da = new OdbcDataAdapter { SelectCommand = conn.CreateCommand() };
      da.SelectCommand.CommandText = sql;
      var dt = new DataTable();
      da.Fill(dt);
      da.Dispose();
      conn.Close();
  
      return dt;
  }
  </code></pre>
  
  <p>But I got an error stating:</p>
  
  <blockquote>
    <p>{"ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"}</p>
  </blockquote>