public Model.stu updatetoselect(string xxid) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from stupasswordtable where id='" + xxid + "' "); Model.stu model = new Model.stu(); DataTable dt = SQLDBhelper.ExecuteDataTable(strSql.ToString()); if (dt.Rows.Count > 0) { model.name = dt.Rows[0]["Name"].ToString(); model.sex = dt.Rows[0]["Sex"].ToString(); model.id = dt.Rows[0]["ID"].ToString(); model.password = dt.Rows[0]["password"].ToString(); model.grade = dt.Rows[0]["grade"].ToString(); model.Class = dt.Rows[0]["class"].ToString(); model.academy = dt.Rows[0]["Academy"].ToString(); model.major = dt.Rows[0]["major"].ToString(); model.phone = dt.Rows[0]["phone"].ToString(); model.email = dt.Rows[0]["Email"].ToString(); model.groupID = dt.Rows[0]["groupID"].ToString(); model.introduce = dt.Rows[0]["introduce"].ToString(); return(model); } else { return(null); } }
private void edit_stu_message_Load(object sender, EventArgs e) { try { Model.stu model = bll.updatetoselect(UserHelper.xxid); textBox1.Text = model.name; comboBox1.Text = model.sex; textBox2.Text = model.id; textBox3.Text = model.password; comboBox2.Text = model.grade; comboBox3.Text = model.Class; comboBox4.Text = model.academy; comboBox5.Text = model.major; textBox4.Text = model.phone; textBox5.Text = model.email; textBox6.Text = model.groupID; textBox9.Text = model.introduce; } catch (Exception ex) { MessageBox.Show(ex.Message); } }