From 19ab7d7231558ab9d8f5c84cd08bcd1a9fa6dc82 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 16 Aug 2018 12:23:18 -0400 Subject: [PATCH] fix transaction calls --- runner.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runner.cs b/runner.cs index 4913af9..bb79ea1 100644 --- a/runner.cs +++ b/runner.cs @@ -52,7 +52,7 @@ namespace test Console.Write("etl start:" + DateTime.Now.ToString()); Console.Write(Environment.NewLine); - pgc.BeginTransaction(); + NpgsqlTransaction pgt = pgc.BeginTransaction(); //--------------------------------------------move to target-------------------------------------------------------- var ibmdr = ibmcmd.ExecuteReader(); @@ -140,11 +140,14 @@ namespace test Console.Write(Environment.NewLine); Console.Write(e.Message); ibmc.Close(); + pgt.Rollback(); pgc.Close(); + } sql = ""; } + pgt.Commit(); ibmc.Close(); pgc.Close();