error handling

This commit is contained in:
Paul Trowbridge 2018-08-20 11:23:22 -04:00
parent 47008ba3f1
commit 2b8573e5bb

View File

@ -24,7 +24,7 @@ namespace test
string msg = "Help:"; string msg = "Help:";
msg = msg + Environment.NewLine; msg = msg + Environment.NewLine;
msg = msg + "version 0.11"; msg = msg + "version 0.12";
msg = msg + Environment.NewLine; msg = msg + Environment.NewLine;
msg = msg + "-scs source connection string"; msg = msg + "-scs source connection string";
msg = msg + Environment.NewLine; msg = msg + Environment.NewLine;
@ -106,7 +106,19 @@ namespace test
Console.Write("etl start:" + DateTime.Now.ToString()); Console.Write("etl start:" + DateTime.Now.ToString());
NpgsqlTransaction pgt = pgc.BeginTransaction(); NpgsqlTransaction pgt = pgc.BeginTransaction();
ibmcmd.CommandTimeout = 600; ibmcmd.CommandTimeout = 600;
var ibmdr = ibmcmd.ExecuteReader(); System.Data.Odbc.OdbcDataReader ibmdr;
try {
ibmdr = ibmcmd.ExecuteReader();
}
catch (Exception e) {
Console.Write(Environment.NewLine);
Console.Write("error on source sql:");
Console.Write(Environment.NewLine);
Console.Write(e.Message);
ibmc.Close();
pgc.Close();
return;
}
//setup getv object array dimensioned to number of columns for scenario //setup getv object array dimensioned to number of columns for scenario
var getv = new object[ibmdr.FieldCount]; var getv = new object[ibmdr.FieldCount];
@ -184,7 +196,7 @@ namespace test
catch (Exception e) { catch (Exception e) {
Console.Write(Environment.NewLine); Console.Write(Environment.NewLine);
Console.Write(e.Message); Console.Write(e.Message);
ibmc.Close(); //ibmc.Close();
pgt.Rollback(); pgt.Rollback();
pgc.Close(); pgc.Close();