Пример #1
0
        private void btnadd_Click(object sender, EventArgs e)
        {
            if (Class1.stuId != -1)
            {
                SqlConnection newcon1 = new SqlConnection(con);
                newcon1.Open();
                string     qu     = "update Student set FirstName='" + txtfname.Text.ToString() + "',LastName='" + txtlname.Text.ToString() + "' ,Contact='" + txtcontact.Text.ToString() + "',Email='" + txtemail.Text.ToString() + "',RegistrationNumber='" + txtregno.Text.ToString() + "' where Id='" + Class1.stuId + "'";
                SqlCommand newcom = new SqlCommand(qu, newcon1);
                newcom.ExecuteNonQuery();
                newcon1.Close();
                Class1.stuId = -1;
            }
            else
            {
                SqlConnection newcon = new SqlConnection(con);
                newcon.Open();
                string     qu     = "insert into Student(FirstName,LastName,Contact,Email,RegistrationNumber,Status) values('" + txtfname.Text.ToString() + "','" + txtlname.Text.ToString() + "','" + txtcontact.Text.ToString() + "','" + txtemail.Text.ToString() + "','" + txtregno.Text.ToString() + "',5)";
                SqlCommand newcom = new SqlCommand(qu, newcon);
                newcom.ExecuteNonQuery();
                newcon.Close();
            }


            this.Hide();
            ManageStudents addnew = new ManageStudents();

            addnew.Show();
        }
Пример #2
0
        private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            ManageStudents addnew = new ManageStudents();

            addnew.Show();
        }