private void Part7_Save_Click(object sender, EventArgs e) { try { //添加数据 UpperLimbsDataInfo.id = txt7ID.Text; UpperLimbsDataInfo.cervicalWristLengthLeft = txtCervicalWristLengthLeft.Text; UpperLimbsDataInfo.cervicalWristLengthRight = txtCervicalWristLengthRight.Text; UpperLimbsDataInfo.armLengthLeft = txtArmLengthLeft.Text; UpperLimbsDataInfo.armLengthRight = txtArmLengthRight.Text; UpperLimbsDataInfo.upperArmLengthLeft = txtUpperArmLengthLeft.Text; UpperLimbsDataInfo.upperArmLengthRight = txtUpperArmLengthRight.Text; UpperLimbsDataInfo.upperArmGirthLeft = txtUpperArmGirthLeft.Text; UpperLimbsDataInfo.upperArmGirthRight = txtUpperArmGirthRight.Text; UpperLimbsDataInfo.wristGirthLeft = txtWristGirthLeft.Text; UpperLimbsDataInfo.wristGirthRight = txtWristGirthRight.Text; UpperLimbsDataInfo.handThickness = txtHandThickness.Text; UpperLimbsDataInfo.handGirth = txtHandGirth.Text; //执行添加 int id = MyMC.AddUpperLimbsData(UpperLimbsDataInfo); MessageBox.Show("新增--上肢数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } dataGridView7.DataSource = MyMC.GetAllUpperLimbsData("UpperLimbsData").Tables[0].DefaultView; this.SetdataGridView7HeadText(); }
private void tlBtnSave_Click(object sender, EventArgs e) { //判断是添加还是修改数据 if (G_Int_addOrUpdate == 0) { try { //添加数据 UpperLimbsDataInfo.id = txtID.Text; UpperLimbsDataInfo.cervicalWristLengthLeft = txtCervicalWristLengthLeft.Text; UpperLimbsDataInfo.cervicalWristLengthRight = txtCervicalWristLengthRight.Text; UpperLimbsDataInfo.armLengthLeft = txtArmLengthLeft.Text; UpperLimbsDataInfo.armLengthRight = txtArmLengthRight.Text; UpperLimbsDataInfo.upperArmLengthLeft = txtUpperArmLengthLeft.Text; UpperLimbsDataInfo.upperArmLengthRight = txtUpperArmLengthRight.Text; UpperLimbsDataInfo.upperArmGirthLeft = txtUpperArmGirthLeft.Text; UpperLimbsDataInfo.upperArmGirthRight = txtUpperArmGirthRight.Text; UpperLimbsDataInfo.wristGirthLeft = txtWristGirthLeft.Text; UpperLimbsDataInfo.wristGirthRight = txtWristGirthRight.Text; UpperLimbsDataInfo.handThickness = txtHandThickness.Text; UpperLimbsDataInfo.handGirth = txtHandGirth.Text; //执行添加 int id = baseinfo.AddUpperLimbsData(UpperLimbsDataInfo); MessageBox.Show("新增--上肢数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { //修改数据 UpperLimbsDataInfo.id = txtID.Text; UpperLimbsDataInfo.cervicalWristLengthLeft = txtCervicalWristLengthLeft.Text; UpperLimbsDataInfo.cervicalWristLengthRight = txtCervicalWristLengthRight.Text; UpperLimbsDataInfo.armLengthLeft = txtArmLengthLeft.Text; UpperLimbsDataInfo.armLengthRight = txtArmLengthRight.Text; UpperLimbsDataInfo.upperArmLengthLeft = txtUpperArmLengthLeft.Text; UpperLimbsDataInfo.upperArmLengthRight = txtUpperArmLengthRight.Text; UpperLimbsDataInfo.upperArmGirthLeft = txtUpperArmGirthLeft.Text; UpperLimbsDataInfo.upperArmGirthRight = txtUpperArmGirthRight.Text; UpperLimbsDataInfo.wristGirthLeft = txtWristGirthLeft.Text; UpperLimbsDataInfo.wristGirthRight = txtWristGirthRight.Text; UpperLimbsDataInfo.handThickness = txtHandThickness.Text; UpperLimbsDataInfo.handGirth = txtHandGirth.Text; //执行修改 int id = baseinfo.UpdateUpperLimbsData(UpperLimbsDataInfo); MessageBox.Show("修改--上肢数据--成功!", "成功提示!", MessageBoxButtons.OK, MessageBoxIcon.Information); } dgvUpperLimbsDataList.DataSource = baseinfo.GetAllUpperLimbsData("UpperLimbsData").Tables[0].DefaultView; this.SetdgvUpperLimbsDataListHeadText(); this.cancelEnabled(); }