Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "" || txtFathers_Name.Text == "" || txtReg_no.Text == "" || txtCourse.Text == "" || txtDoj.Text == "" || txtDoj.Text == "" || txtCompletionDate.Text == "" || txtGrade.Text == "" || txtMarks.Text == "")
            {
                MessageBox.Show("all fields are required");
            }
            else
            {
                con = new SqlConnection(connstr);
                con.Open();
                cmd = new SqlCommand("insert into student values(@n,@f,@r,@c,@dj,@dc,@g,@m)", con);
                cmd.Parameters.Add(new SqlParameter("@n", txtName.Text));
                cmd.Parameters.Add(new SqlParameter("@f", txtFathers_Name.Text));
                cmd.Parameters.Add(new SqlParameter("@r", Convert.ToInt32(txtReg_no.Text)));
                cmd.Parameters.Add(new SqlParameter("@c", txtCourse.Text));
                cmd.Parameters.Add(new SqlParameter("@dj", txtDoj.Text));
                cmd.Parameters.Add(new SqlParameter("@dc", txtCompletionDate.Text));
                cmd.Parameters.Add(new SqlParameter("@g", txtGrade.Text));
                cmd.Parameters.Add(new SqlParameter("@m", Convert.ToDecimal(txtMarks.Text)));
                dr = cmd.ExecuteReader();

                MessageBox.Show("student details saved");
                this.Hide();
                menu m = new menu();
                m.Show();
            }
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            menu m = new menu();

            m.Show();
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtUser_Name.Text == "user366pi" && txtPassword.Text == "366pi")
            {
                this.Hide();
                menu m = new menu();
                m.Show();
            }
            else if (txtUser_Name.Text == "" || txtPassword.Text == "")
            {
                MessageBox.Show("Please fill the user name and password");
            }

            else
            {
                MessageBox.Show("Not a valid user.", "Login", MessageBoxButtons.OK);
                txtUser_Name.Text = "";
                txtPassword.Text  = "";
            }
        }