set connection string error handling

This commit is contained in:
Paul Trowbridge 2018-09-20 11:39:35 -04:00
parent a58279e491
commit 8af22b157d

View File

@ -21,6 +21,8 @@ namespace test
string nr = ""; string nr = "";
string nc = ""; string nc = "";
string nl = Environment.NewLine; string nl = Environment.NewLine;
var ibmc;
var pgc;
string msg = "Help:"; string msg = "Help:";
msg = msg + nl + "version 0.22"; msg = msg + nl + "version 0.22";
@ -95,8 +97,18 @@ namespace test
//-------------------------------------------establish connections------------------------------------------------- //-------------------------------------------establish connections-------------------------------------------------
var ibmc = new System.Data.Odbc.OdbcConnection(scs); try {
var pgc = new NpgsqlConnection(dcs); ibmc = new System.Data.Odbc.OdbcConnection(scs);
}
catch (Exception e) {
Console.Write(nl + "bad source connection string: " + e.Message);
}
try {
pgc = new NpgsqlConnection(dcs);
}
catch (Exception e) {
Console.Write(nl + "bad source connection string: " + e.Message);
}
try { try {
ibmc.Open(); ibmc.Open();
} }