I'm trying to develop a program that will connect to a Progress Database (9.1E) using C# (Visual Studio 2010 Ultimate), but I first need to get a connection string to the Progress Database from the C# program.
I have tried the following, but I'm unsuccessful in establishing a connection to the Progress database. I'm not sure what the connection string should look like, but here's what I have before I start expanding everything. Also, I'm not sure what the DSN name should be.
private void downloadData_Click(object sender, RoutedEventArgs e)
{
try
{
string connectString = "DSN = QADDB; Host = ipaddress; DB = dbname; UID = user; PWD = password;";
IDbConnection dbConn = new OdbcConnection(connectString);
dbConn.Open();
IDbCommand dbCommand = dbConn.CreateCommand();
string sqlstr = "SELECT pt_part FROM pt_mstr";
dbCommand.CommandText = sqlstr;
IDataReader reader = dbCommand.ExecuteReader();
while (reader.Read())
{
string part = (string)reader["pt_part"];
gridview.Items.Add(part);
}
reader.Close();
reader = null;
dbCommand.Dispose();
dbCommand = null;
dbConn.Close();
dbConn = null;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
The error message says:
System.Data.Odbc.OdbcException (0X80131937): ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
In your connection string, set the port of your Progress database:
PORT=20931;