Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            frmAddStudents mgs = new frmAddStudents();

            mgs.Show();
            this.Hide();
        }
Ejemplo n.º 2
0
        private void btnStdMang_Click(object sender, EventArgs e)
        {
            frmAddStudents addStd = new frmAddStudents();

            addStd.Show();
            this.Hide();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Save Data Of Form After Editing
        /// </summary>
        public void SaveData()
        {
            if ((txtFirstName.Text != "") && (txtLsrName.Text != "") && (txtRegNo.Text != "") && (txtContact.Text != "") && (txtEmail.Text != "") && (cboStatus.Text != ""))
            {
                String        conURL1 = "Data Source = DESKTOP-RPO4Q5R\\PARVEEN; Initial Catalog = ProjectB ; User ID = mohsin; Password = mohsin123; MultipleActiveResultSets = True";
                SqlConnection conn1   = new SqlConnection(conURL1);
                conn1.Open();
                int status = 0;
                if (cboStatus.Text == "Active")
                {
                    status = 5;
                }
                else
                {
                    status = 6;
                }
                String cmd1 = "update Student set FirstName='" + txtFirstName.Text + "', LastName= '" + txtLsrName.Text + "', Contact= '" + txtContact.Text + "',Email='" +
                              txtEmail.Text + "', RegistrationNumber='" + txtRegNo.Text + "',Status='" + status + "' Where  Student.Id = '" + MyClass.count + "'";

                SqlCommand cmd = new SqlCommand(cmd1, conn1);
                MessageBox.Show("The Record Of Studdent Has been updated");
                try
                {
                    cmd.ExecuteReader();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex + " Record Has Been Updated ");
                }
                frmAddStudents addStd = new frmAddStudents();
                addStd.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("All field should be field");
            }
        }