summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Aktywator/Bws.cs21
1 files changed, 15 insertions, 6 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs
index 7f8a899..e1921a8 100644
--- a/Aktywator/Bws.cs
+++ b/Aktywator/Bws.cs
@@ -331,15 +331,24 @@ namespace Aktywator
name = Common.bezOgonkow(name);
if (name.Length > 18)
name = name.Substring(0, 18);
- string actual = sql.selectOne("SELECT Name FROM PlayerNumbers WHERE `Section`=" + section + " AND `Table`=" + table
- + " AND `Direction`='" + direction + "'");
- if (actual != name)
+ try
+ {
+ string actual = sql.selectOne("SELECT Name FROM PlayerNumbers WHERE `Section`=" + section + " AND `Table`=" + table
+ + " AND `Direction`='" + direction + "'", true);
+ if (actual != name)
+ {
+ sql.query("UPDATE PlayerNumbers SET Name='" + name + "', Updated=TRUE WHERE `Section`=" + section + " AND `Table`=" + table
+ + " AND `Direction`='" + direction + "'");
+ return 1;
+ }
+ else return 0;
+ }
+ catch (OleDbRowMissingException)
{
- sql.query("UPDATE PlayerNumbers SET Name='" + name + "', Updated=TRUE WHERE `Section`=" + section + " AND `Table`=" + table
- + " AND `Direction`='" + direction + "'");
+ sql.query("INSERT INTO PlayerNumbers(`Section`, `Table`, Direction, Name, Updated) VALUES("
+ + section + ", " + table + ", '" + direction + "', '" + name + "', TRUE)");
return 1;
}
- else return 0;
}
private int getBWSNumber(OleDbDataReader reader, int index)