diff --git a/MCGalaxy_.csproj b/MCGalaxy_.csproj
index 99c05dc8b..017876711 100644
--- a/MCGalaxy_.csproj
+++ b/MCGalaxy_.csproj
@@ -86,7 +86,6 @@
-
System.Data.SQLite.dll
diff --git a/Server/BackupDB.cs b/Server/BackupDB.cs
index ff38c9588..6bd5b6907 100644
--- a/Server/BackupDB.cs
+++ b/Server/BackupDB.cs
@@ -83,20 +83,22 @@ namespace MCGalaxy {
sql.WriteLine();
sql.Write("(");
- for (int col = 0; col < row.ItemArray.Length; col++) {
+ for (int col = 0; col < data.Columns.Count; col++) {
//The values themselves can be integers or strings, or null
- Type eleType = allCols[col].DataType;
+ Type type = allCols[col].DataType;
if (row.IsNull(col)) {
sql.Write("NULL");
- } else if (eleType.Name.Equals("DateTime")) { // special format
- DateTime dt = row.Field(col);
- sql.Write("'{0:yyyy-MM-dd HH:mm:ss.ffff}'", dt);
- } else if (eleType.Name.Equals("Boolean")) {
- sql.Write(row.Field(col) ? "1" : "0");
- } else if (eleType.Name.Equals("String")) { // Requires ''
- sql.Write("'{0}'", row.Field(col));
+ } else if (type == typeof(DateTime)) { // special format
+ sql.Write("'{0:yyyy-MM-dd HH:mm:ss.ffff}'", (DateTime)row[col]);
+ } else if (type == typeof(bool)) {
+ sql.Write((bool)row[col] ? "1" : "0");
+ } else if (type == typeof(string)) { // Requires ''
+ string value = row[col].ToString();
+ if (value.IndexOf(' ') >= 0)
+ value = value.Replace("'", "''");
+ sql.Write("'{0}'", value);
} else {
- sql.Write(row.Field