Esempio n. 1
0
        private void button_person_Click(object sender, EventArgs e)
        {
            FormPersoninputUserID_M formPersonUserID = new FormPersoninputUserID_M();

            formPersonUserID.Show();
            this.Hide();
        }
Esempio n. 2
0
        private void FormPersonM_Load(object sender, EventArgs e)
        {
            String id = label_id.Text.Trim();

            try
            {
                con.Open();
                string sql = "SELECT * FROM SysUser WHERE UserID = '" + id + "'";

                SqlCommand     command     = new SqlCommand(sql, con);
                SqlDataAdapter dataAdapter = new SqlDataAdapter(command);
                //创建DataSet对象
                DataSet dataSet = new DataSet();
                dataAdapter.Fill(dataSet, "SysUser");
                int c = dataSet.Tables["SysUser"].Rows.Count;

                if (c > 0)
                {
                    label_schoolid.Text = (string)dataSet.Tables["SysUser"].Rows[0]["UserSchoolID"];
                    label_mobile.Text   = (string)dataSet.Tables["SysUser"].Rows[0]["UserMobile"];
                    label_birth.Text    = dataSet.Tables["SysUser"].Rows[0]["UserBirthday"].ToString();

                    Byte[] mybyte = new byte[0];
                    mybyte = (Byte[])(dataSet.Tables["SysUser"].Rows[c - 1]["UserPhoto"]);
                    MemoryStream ms = new MemoryStream(mybyte);
                    pictureBox1.Image = Image.FromStream(ms);
                }
                else
                {
                    pictureBox1.Image = null;
                    con.Close();
                    MessageBox.Show("该用户不存在,请返回输入正确的用户名!", "Tips", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    FormPersoninputUserID_M formPersonUserID = new FormPersoninputUserID_M();
                    formPersonUserID.Show();
                    this.Close();
                }
                //以上为读取个人信息
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                label_id.Text = "出错!";
            }
            finally
            {
                con.Close();
            }
        }