private void btnSave_Click(object sender, System.EventArgs e) { try { bmb.EndCurrentEdit(); da.Update(ds, "客房标准信息"); ds.Clear(); da.Fill(ds, "客房标准信息"); bmb = this.BindingContext[ds, "客房标准信息"]; this.label6.Text = "当前记录:" + (this.dataGrid1.CurrentRowIndex + 1); this.label7.Text = "记录数:" + this.bmb.Count; MessageBox.Show("记录修改成功"); } catch (Exception ex) { MessageBox.Show("修改失败:" + ex.Message.ToString()); } }
private void btnAll_Click(object sender, System.EventArgs e) { this.sqlSelectCommand1.CommandText = "Select * from 帐单明细历史"; ds.Clear(); da.Fill(this.ds, "帐单明细历史"); bmb = this.BindingContext[ds, "帐单明细历史"]; this.label23.Text = "当前记录:" + (this.dataGrid1.CurrentRowIndex + 1); this.label24.Text = "记录数:" + this.bmb.Count; }
private void btnDelete_Click(object sender, System.EventArgs e) { try { if (DialogResult.OK == MessageBox.Show("确定删除记录?", "确定", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { this.ds.管理员.Rows[this.bmb.Position].Delete(); da.Update(ds, "管理员"); ds.Clear(); da.Fill(ds, "管理员"); bmb = this.BindingContext[ds, "管理员"]; this.label6.Text = "当前记录:" + (this.dataGrid1.CurrentRowIndex + 1); this.label7.Text = "记录数:" + this.bmb.Count; MessageBox.Show("记录删除成功"); } else { } } catch (Exception ex) { MessageBox.Show("删除无效:" + ex.Message.ToString()); } }