示例#1
0
        private void Init()
        {
            string sqlstr = "select * from Student where ID='" + txtID.Text.Trim() + "'";

            App_Code.ConnectionClass myconnection = new App_Code.ConnectionClass();
            DataSet myDataSet = myconnection.getDataSet(sqlstr, "Student");

            txtName.Text    = myDataSet.Tables["Student"].Rows[0]["StudentName"].ToString();
            txtPhone.Text   = myDataSet.Tables["Student"].Rows[0]["Phone"].ToString();
            txtIdenID.Text  = myDataSet.Tables["Student"].Rows[0]["IdentityID"].ToString();
            txtAddress.Text = myDataSet.Tables["Student"].Rows[0]["Address"].ToString();
            string sex = myDataSet.Tables["Student"].Rows[0]["Sex"].ToString();

            if (sex == "男")
            {
                rbMale.Checked = true;
            }
            else
            {
                rbFemale.Checked = true;
            }
        }