Пример #1
0
        private void Delete_Track_Click(object sender, EventArgs e)
        {
            String ID     = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells["playlist"].Value.ToString();
            String title  = dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["title"].Value.ToString();
            String artist = dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["artist"].Value.ToString();

            int       k   = abc.DeleteTrack(title, artist, ID);
            DataTable dt1 = abc.GetTrack(ID);

            dataGridView2.DataSource = dt1;
            if (k == 1)
            {
                MessageBox.Show("Delete successfully!");
            }
            else
            {
                MessageBox.Show("Fail to delete or non-exist!");
            }
        }
Пример #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.IndexOf(' ') != -1 || textBox2.Text.IndexOf(' ') != -1 || textBox3.Text.IndexOf(' ') != -1 || textBox4.Text.IndexOf(' ') != -1)
     {
         label5.Text = "No blank is permitted!";
     }
     else if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "")
     {
         label5.Text = "No box cannot be vacant!";
     }
     else if (abc.DeleteTrack(title, artist, playlist) == 1 && abc.AddTrack(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, playlist, Public.Checked == true ? "Y" : "N") == 1)  // 需修改
     {
         this.DialogResult = DialogResult.OK;
     }
     else
     {
         abc.AddTrack(title, artist, album, genre, playlist, "Y");
         label5.Text = "Fail to update!";
     }
 }