示例#1
0
        private void MemberUpdateButton_Click(object sender, RoutedEventArgs e)
        {
            string id   = MemberIdTextBox.Text;
            string name = MemberNameTextBox.Text;
            //MessageBox.Show(id);
            SqlConnection connection = new SqlConnection("Server=Tanmoy-PC; Database=Wedding Management; User Id=sa; Password=1238628257");

            connection.Open();



            UpdateMember updateMember = new UpdateMember();
            //MemberServices sr = new MemberServices();
            //  SqlCommand cmd = new SqlCommand(sr.getById(id));
            //  SqlDataReader reader = cmd.ExecuteReader();
            // if (reader.HasRows)
            // {
            // if (reader.GetString(0) == id)
            //  {
            MemberServices memberservices = new MemberServices();
            Members        members        = new Members();

            memberservices.SetForUpdate(id);
            // MessageBox.Show(id);


            updateMember.UpdatenameTextBoxa.Text        = members.MemberName;
            updateMember.UpdatepositionTextBoxa.Text    = members.MemberPosition;
            updateMember.UpdatedateOfBirthTextBoxa.Text = members.DateOfBirth;
            updateMember.UpdatejoinDateTextBoxa.Text    = members.JoinDate;
            updateMember.UpdatecontactNoTextBoxa.Text   = members.ContactNumber;
            updateMember.UpdateemailTextBoxa.Text       = members.Email;
            updateMember.UpdateaddressTextBoxa.Text     = members.Address;
            updateMember.UpdatesalaryTextBoxa.Text      = members.Salary;
            updateMember.Show();
        }