diff options
author | emkael <emkael@tlen.pl> | 2017-07-30 00:05:58 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-07-30 00:05:58 +0200 |
commit | ae2d439f7d67404590e78d0bb8cf6b858bca7d0c (patch) | |
tree | 712a2ce5b3d724ee10fe74d9f9229abae057bed4 /Aktywator/Bws.cs | |
parent | daeb4826264484305141f443f37df7e6ba9ac6e9 (diff) |
Fixed control flow on names sync abort - MySQL data reader was not closed properly if user chose not to continue syncing on first warning.
Also, the same choice (Continue? Yes/No) is offered on any other MySQL error
Diffstat (limited to 'Aktywator/Bws.cs')
-rw-r--r-- | Aktywator/Bws.cs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs index 4a7ec16..6a3b394 100644 --- a/Aktywator/Bws.cs +++ b/Aktywator/Bws.cs @@ -396,6 +396,8 @@ namespace Aktywator } mydata n = tournament.mysql.select(query.ToString()); + DialogResult dr = DialogResult.None; + try { n.Read(); @@ -424,23 +426,27 @@ namespace Aktywator { if (ee.ErrorCode == -2147467259) { - DialogResult dr = MessageBox.Show("W bws-ie jest para/team (" + ns + " albo " + ew + dr = MessageBox.Show("W bws-ie jest para/team (" + ns + " albo " + ew + "), który nie istnieje w wybranym turnieju. Może to nie ten turniej?" + "\n\n" + "Kontynuować wczytywanie?", "Zły turniej", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); - if (dr == DialogResult.No) return; } else { - MessageBox.Show(ee.Message, "Błąd MySQL", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning); + dr = MessageBox.Show(ee.Message + "\n\n" + "Kontynuować?", + "Błąd MySQL", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); } } } - try + finally { - n.Close(); + try + { + n.Close(); + } + catch (Exception) { } } - catch (Exception) { } + if (dr == DialogResult.No) break; } if (interactive) { |