private void AddUser_Load(object sender, EventArgs e) { technologyLib = new TechnologyLib(sqlConnection); dataSet = new DataSet(); technologyLib.GetUserGrpData(dataSet, UserGrpName); technologyLib.GetUserGrpDetailsViewData(dataSet); technologyLib.GetUserInfoDetailsViewData(dataSet); m_UserGrpID = technologyLib.GetUserGrpID(UserGrpName); switch (m_OperateFlag) { case 1: //添加 textBoxBarCode.Text = Convert.ToString(technologyLib.GetUserInfoMaxBarCode() + 1); break; case 2: //属性 textBoxBarCode.ReadOnly = true; for (int i = 0; i < dataSet.Tables["UserInfoDetailsView"].Rows.Count; i++) { if (BarCode == dataSet.Tables["UserInfoDetailsView"].Rows[i]["BarCode"].ToString()) { comboBoxUserGrpName.Text = dataSet.Tables["UserInfoDetailsView"].Rows[i]["UserGrpName"].ToString(); textBoxBarCode.Text = dataSet.Tables["UserInfoDetailsView"].Rows[i]["BarCode"].ToString(); textBoxUserName.Text = dataSet.Tables["UserInfoDetailsView"].Rows[i]["UserName"].ToString(); textBoxUserPsw.Text = dataSet.Tables["UserInfoDetailsView"].Rows[i]["Password"].ToString(); textBoxVerifyPsw.Text = dataSet.Tables["UserInfoDetailsView"].Rows[i]["Password"].ToString(); comboBoxSex.Text = dataSet.Tables["UserInfoDetailsView"].Rows[i]["Sex"].ToString(); textBoxTelephone.Text = dataSet.Tables["UserInfoDetailsView"].Rows[i]["Telephone"].ToString(); dateTimePickerBirthday.Text = dataSet.Tables["UserInfoDetailsView"].Rows[i]["Birthday"].ToString(); richTextBoxDescription.Text = dataSet.Tables["UserInfoDetailsView"].Rows[i]["Description"].ToString(); comboBoxStatus.Text = dataSet.Tables["UserInfoDetailsView"].Rows[i]["Status"].ToString(); break; } } break; } }