Example #1
0
        private void Profile_Load(object sender, EventArgs e)
        {
            gettersetter setter_profile = new gettersetter();

            Conn.Open();
            SqlCommand Comm1 = new SqlCommand("Sp_Select_EmpInfo", Conn);

            Comm1.Parameters.AddWithValue("@p_EmpID", setter_profile.getEmp_ID());
            Comm1.CommandType = CommandType.StoredProcedure;
            SqlDataReader DR1 = Comm1.ExecuteReader();

            while (DR1.Read())
            {
                text_ID.Text      = DR1["Emp_ID"].ToString();
                text_Fname.Text   = DR1["FirstName"].ToString();
                text_Lname.Text   = DR1["LastName"].ToString();
                text_Age.Text     = DR1["Age"].ToString();
                text_Bdate.Text   = DR1["Birthdate"].ToString();
                text_Address.Text = DR1["Emp_Address"].ToString();
                sampleAge.Text    = DR1["Age"].ToString();
            }
        }
        public void EmpRefresh()
        {
            gettersetter setter_profile = new gettersetter();

            Conn.Open();
            SqlDataAdapter Comm1 = new SqlDataAdapter("sp_Emp_Read", Conn);

            Comm1.SelectCommand.Parameters.AddWithValue("@Emp_ID", setter_profile.getEmp_ID());
            Comm1.SelectCommand.CommandType = CommandType.StoredProcedure;


            DataTable dt = new DataTable();

            Comm1.Fill(dt);
            label1ID.DataBindings.Clear();
            labelFname.DataBindings.Clear();
            labelLName.DataBindings.Clear();
            label1Age.DataBindings.Clear();
            label1Bdate.DataBindings.Clear();
            label1Address.DataBindings.Clear();
            label1username.DataBindings.Clear();
            label1userpass.DataBindings.Clear();
            label_ERate.DataBindings.Clear();

            label1ID.DataBindings.Add("Text", dt, "Emp_ID");
            labelFname.DataBindings.Add("Text", dt, "FirstName");
            labelLName.DataBindings.Add("Text", dt, "LastName");
            label1Age.DataBindings.Add("Text", dt, "Age");
            label1Bdate.DataBindings.Add("Text", dt, "Birthdate");
            label1Address.DataBindings.Add("Text", dt, "Emp_Address");
            label1username.DataBindings.Add("Text", dt, "username");
            label1userpass.DataBindings.Add("Text", dt, "userpass");
            label_ERate.DataBindings.Add("Text", dt, "Emp_Rate");
            dataRepeater1.DataSource = dt;
            Conn.Close();
        }