private void btnSaveGroup_Click(object sender, EventArgs e) { Group group = new Group(); if (txtGroupName.Text == "") { MessageBox.Show("分组名称不能为空"); return; } group.GroupName = txtGroupName.Text; try { groupBLL.InsertObject(group); dgvGroupList.DataSource = groupBLL.FindAllInfo(); MessageBox.Show("保存成功"); } catch (Exception ex) { MessageBox.Show("保存数据错误" + ex.Message); } }