예제 #1
0
파일: DB.cs 프로젝트: tomsun100/wow-find
        public void AddToon(Toon t)
        {
            string cmd = "INSERT INTO Toon VALUES (";
            cmd += ConvertToSQL(t.userID) + ",";
            cmd += ConvertToSQL(t.name) + ",";
            for (int i = 0; i < 3; i++) {
                SpecLvl s = t.specs[i];
                cmd += ConvertToSQL(s?.spec) + ",";
                cmd += ConvertToSQL(s?.ilvl) + ",";
            }
            cmd += ConvertToSQL(t.role) + ",";
            cmd += ConvertToSQL(t.region) + ",";
            cmd += ConvertToSQL(t.server) + ",";
            cmd += ConvertToSQL(t.transfer) + ",";
            cmd += ConvertToSQL(t.faction) + ",";
            cmd += ConvertToSQL(t.factionchange) + ",";
            cmd += ConvertToSQL(t.hours) + ",";
            for (int i = 0; i < 7; i++) {
                cmd += ConvertToSQL(t.days[i]) + ",";
            }
            cmd += ConvertToSQL(t.daysperweek) + ",";
            cmd += ConvertToSQL(t.progression) + ",";
            cmd += ConvertToSQL(t.atmosphere) + ",";
            cmd += ConvertToSQL(t.activity) + ",";
            cmd += ConvertToSQL(t.blurb) + ",";
            cmd += ConvertToSQL(t.warcraftLogs) + ",";
            cmd += ConvertToSQL(t.WoWForums);

            new SQLiteCommand(cmd, dbConnection).ExecuteNonQuery();
        }
예제 #2
0
파일: DB.cs 프로젝트: tomsun100/wow-find
 public List<Toon> getAllToons(Toon t)
 {
     List<Toon> list = new List<Toon>();
     string cmd = "SELECT * FROM Toons";
     SQLiteDataReader reader = new SQLiteCommand(cmd, dbConnection).ExecuteReader();
     while (reader.Read()) {
         object[] values = new object[reader.FieldCount];
         reader.GetValues(values);
         list.Add(new Toon(values));
     }
     return list;
 }