Answers for "how to set progress openedge driver name for odbc connection c#"

C#
2

how to set progress openedge driver name for odbc connection c#

DSN-less Connection String:
DRIVER=<ODBC Driver Name>;HOST=<Hostname>;PORT=<Port>;DB=<Database Name>;UID=<Username>;PWD=<Password>;DIL=<DEFAULT ISOLATION LEVEL>

ODBC Driver Name
The name of the ODBC driver as it appears in Drivers tab of the Microsoft ODBC Data Source Administrator or in HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI
Posted by: Guest on April-19-2020
2

progress openedge odbc connection string c#

using System;
using System.Data;
using System.Data.Odbc;
 
public class TestConnect
{
   public static void Main(string[] args)
   {
      //The connection string assumes there is a DSN named sports for a Progress database.
      //Alternatively, a DSN-less connection string could be used in its place. See article# 000022406 for more details.

      string connectionString =  "DSN=sports;" +
                                 "UID=sysprogress;" +
                                 "PWD=x";
      IDbConnection dbconn;
      dbconn = new OdbcConnection(connectionString);
      dbconn.Open();
      IDbCommand dbcmd = dbconn.CreateCommand();
      string sqlstr =   "SELECT country,name FROM pub.customer";
      dbcmd.CommandText = sqlstr;
      IDataReader reader = dbcmd.ExecuteReader();
      while(reader.Read()) {
           string country = (string) reader["country"];
           string name = (string) reader["name"];
           Console.WriteLine("Customer : " + name  +  " country is: " + country );
      }       
      reader.Close();
      reader = null;
      dbcmd.Dispose();
      dbcmd = null;
      dbconn.Close();
      dbconn = null;
   }
}
Posted by: Guest on April-19-2020

Code answers related to "how to set progress openedge driver name for odbc connection c#"

C# Answers by Framework

Browse Popular Code Answers by Language