コード例 #1
0
        /// <summary>
        /// 点击删除按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button4_Click(object sender, EventArgs e)
        {
            if (textBox8.Text == "")
            {
                MessageBox.Show("ID不可为空"); return;
            }
            Ticket model = new Ticket();

            model.Id = Convert.ToInt32(textBox8.Text);
            if (TicketDAL.FindModel(new Ticket(model.Id), "id") == null)
            {
                MessageBox.Show("不存在此ID"); return;
            }
            if (TicketDAL.Drop(model, "id"))
            {
                FillDataGirdView(); MessageBox.Show("删除成功"); return;
            }
        }