set connection string error handling
This commit is contained in:
parent
a58279e491
commit
8af22b157d
16
runner.cs
16
runner.cs
@ -21,6 +21,8 @@ namespace test
|
||||
string nr = "";
|
||||
string nc = "";
|
||||
string nl = Environment.NewLine;
|
||||
var ibmc;
|
||||
var pgc;
|
||||
|
||||
string msg = "Help:";
|
||||
msg = msg + nl + "version 0.22";
|
||||
@ -95,8 +97,18 @@ namespace test
|
||||
|
||||
//-------------------------------------------establish connections-------------------------------------------------
|
||||
|
||||
var ibmc = new System.Data.Odbc.OdbcConnection(scs);
|
||||
var pgc = new NpgsqlConnection(dcs);
|
||||
try {
|
||||
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 {
|
||||
ibmc.Open();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user