Ejemplo n.º 1
0
        private void AddCustomRecord(string obj)
        {
            CustomCmd.CommandText = "SELECT COUNT(Item) FROM CustomList WHERE Item = '" + obj + "'";
            long i = (long)CustomCmd.ExecuteScalar();

            if (i == 0)
            {
                CustomCmd.CommandText = "INSERT INTO CustomList (Item) VALUES ('" + obj + "')";
                CustomCmd.ExecuteNonQuery();
                CustomListBox.Items.Add(CustomAdderText.Text);
                CustomAdderText.Text = "";
            }
            else
            {
                MessageBox.Show("既に追加されている要素です。");
            }
        }
Ejemplo n.º 2
0
 //接続
 private void ConnectDB()
 {
     if (System.IO.File.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\GalaxySoftware\\wcatManager\\DataLists\\PlayerList.db"))
     {
         TeamCon = new SQLiteConnection(TeamDBPath);
         TeamCon.Open();
         TeamCmd = TeamCon.CreateCommand();
     }
     else
     {
         TeamCon = new SQLiteConnection(TeamDBPath);
         TeamCon.Open();
         TeamCmd             = TeamCon.CreateCommand();
         TeamCmd.CommandText = "CREATE TABLE PlayerList (id integer primary key, Player varchar)";
         TeamCmd.ExecuteNonQuery();
     }
     if (System.IO.File.Exists(System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\\GalaxySoftware\\wcatManager\\DataLists\\CustomList.db"))
     {
         CustomCon = new SQLiteConnection(CustomDBPath);
         CustomCon.Open();
         CustomCmd = CustomCon.CreateCommand();
     }
     else
     {
         CustomCon = new SQLiteConnection(CustomDBPath);
         CustomCon.Open();
         CustomCmd             = CustomCon.CreateCommand();
         CustomCmd.CommandText = "CREATE TABLE CustomList (id integer primary key, Item varchar)";
         CustomCmd.ExecuteNonQuery();
     }
     BindCon = new SQLiteConnection("Data Source=" + @"DataLists\\SpecifiedBindList.db");
     BindCon.Open();
     BindCmd = BindCon.CreateCommand();
     JobCon  = new SQLiteConnection("Data Source=" + @"DataLists\\JobList.db");
     JobCon.Open();
     JobCmd  = JobCon.CreateCommand();
     TypeCon = new SQLiteConnection("Data Source=" + @"DataLists\\TypeList.db");
     TypeCon.Open();
     TypeCmd = TypeCon.CreateCommand();
     MapCon  = new SQLiteConnection("Data Source=" + @"DataLists\\MapList.db");
     MapCon.Open();
     MapCmd = MapCon.CreateCommand();
 }
Ejemplo n.º 3
0
 private void RemoveCustomRecord(string obj)
 {
     CustomCmd.CommandText = "DELETE FROM CustomList WHERE Item = '" + obj + "'";
     CustomCmd.ExecuteNonQuery();
     RefreshCustomList();
 }