private void butInsertSQL_Click(object sender, EventArgs e) { if (!flag) { MessageBox.Show("待插入的数据为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { bool temp = false; for (int i = 0; i <= index; i++) { SqlParameter[] paraValues = { new SqlParameter("@StaffNum", SqlDbType.Char), new SqlParameter("@StaffName", SqlDbType.Char), new SqlParameter("@StaffSex", SqlDbType.Char), new SqlParameter("@StaffTime", SqlDbType.DateTime), new SqlParameter("@StaffDuty", SqlDbType.Char) }; for (int j = 0; j < 5; j++) { paraValues[j].Value = setStaffMessage.Rows[i].Cells[j].Value.ToString(); } temp = Manipulation.Manipulation.insertStoredProcedure("Insert_Staff", paraValues); } if (temp) { MessageBox.Show("所有数据插入成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } InformationManage.clear(setStaffMessage); } }
private void butCancel_Click(object sender, EventArgs e) { if (index <= 0) { flag = false; InformationManage.clear(setStaffMessage); } else { InformationManage.remove(setStaffMessage, index); index--; } }
private void butInsertSQL_Click(object sender, EventArgs e) { if (!flag) { MessageBox.Show("待插入的数据为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { bool temp = false; for (int i = 0; i <= index; i++) { SqlParameter[] paraValues = { new SqlParameter("@DrugNum", SqlDbType.Char), new SqlParameter("@DrugName", SqlDbType.Char), new SqlParameter("@Birthday", SqlDbType.Char), new SqlParameter("@Validity", SqlDbType.Char), new SqlParameter("@DrugFunction", SqlDbType.Char), new SqlParameter("@SupplierNum", SqlDbType.Char), new SqlParameter("@SupplierPrice", SqlDbType.Char), new SqlParameter("@SupplyNum", SqlDbType.Char), new SqlParameter("@SupplyTime", SqlDbType.Char) }; for (int j = 0; j < 9; j++) { paraValues[j].Value = setPurchaseMessage.Rows[i].Cells[j].Value.ToString(); } temp = Manipulation.Manipulation.insertStoredProcedure("Insert_SupplierShip", paraValues); if (temp) { SqlParameter[] MinusParaValues = { new SqlParameter("@DrugNum", SqlDbType.Char), new SqlParameter("@SupplyNum", SqlDbType.Int) }; MinusParaValues[0].Value = setPurchaseMessage.Rows[i].Cells[0].Value.ToString(); MinusParaValues[1].Value = setPurchaseMessage.Rows[i].Cells[7].Value.ToString(); Manipulation.Manipulation.insertStoredProcedure("Add_Drug", MinusParaValues); temp = false; } } if (temp) { MessageBox.Show("所有数据插入成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } InformationManage.clear(setPurchaseMessage); } }
/** * 插入数据库按钮点击事件 */ private void butInsertSQL_Click(object sender, System.EventArgs e) { if (!flag) { MessageBox.Show("待插入的数据为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { bool temp = false; for (int i = 0; i <= index; i++) { SqlParameter[] insertParaValues = { new SqlParameter("@DrugNum", SqlDbType.Char), new SqlParameter("@CustomerNum", SqlDbType.Char), new SqlParameter("@DemandPrice", SqlDbType.Real), new SqlParameter("@DemandNum", SqlDbType.Int), new SqlParameter("@DamandTime", SqlDbType.DateTime), }; for (int j = 0; j < 5; j++) { insertParaValues[j].Value = setDrugMessage.Rows[i].Cells[j].Value.ToString(); } temp = Manipulation.Manipulation.insertStoredProcedure("Insert_DemandShip", insertParaValues); if (temp) { SqlParameter[] MinusParaValues = { new SqlParameter("@DrugNum", SqlDbType.Char), new SqlParameter("@DemandNum", SqlDbType.Int) }; MinusParaValues[0].Value = setDrugMessage.Rows[i].Cells[0].Value.ToString(); MinusParaValues[1].Value = setDrugMessage.Rows[i].Cells[3].Value.ToString(); Manipulation.Manipulation.insertStoredProcedure("Minus_Drug", MinusParaValues); temp = false; } } if (temp) { MessageBox.Show("所有数据插入成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } InformationManage.clear(setDrugMessage); } }