private void button6_Click_1(object sender, EventArgs e)//确认添加 { ad_ServicesBLL BLL = new ad_ServicesBLL(); TeacherData teacherData = new TeacherData(); teacherData.TeaNo = tbteano.Text.Trim(); teacherData.TeaPwd = tbteapwd.Text.Trim(); teacherData.TeaName = tbteaname.Text.Trim(); teacherData.Academy = tbacademy.Text.Trim(); teacherData.GroupNumber = Convert.ToInt32(tbgroupnumber.Text.Trim()); if (BLL.InsertTeabll(teacherData)) { MessageBox.Show("导入成功", "提示", MessageBoxButtons.OK); tbteano.Text = ""; tbteapwd.Text = ""; tbteaname.Text = ""; tbacademy.Text = ""; tbgroupnumber.Text = ""; DataTable table = BLL.SelectTeabll(); Teagridview.DataSource = table; } else { MessageBox.Show("导入失败", "提示", MessageBoxButtons.OKCancel); } }
private void button5_Click(object sender, EventArgs e)//删除 { string teano = Teagridview.Rows[Teagridview.CurrentRow.Index].Cells[0].Value.ToString(); ad_ServicesBLL bLL = new ad_ServicesBLL(); if (bLL.RemoveTeadata(teano)) { MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK); ad_ServicesBLL BLL = new ad_ServicesBLL(); DataTable table = BLL.SelectTeabll(); Teagridview.DataSource = table; } else { MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK); } }
private void Form1_Load(object sender, EventArgs e) { ad_ServicesBLL bLL = new ad_ServicesBLL(); Teagridview.DataSource = bLL.SelectTeabll(); }