コード例 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            AdminPage a1 = new AdminPage();

            a1.Show();
            this.Hide();
        }
コード例 #2
0
ファイル: AddStaff.cs プロジェクト: karthikk1612/Exam_Manager
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection("Server=.\\SQLEXPRESS; Database= ExamManager;Integrated Security =true");

            conn.Open();
            String     str = "'" + textBox1.Text.ToString() + "','" + textBox2.Text.ToString() + "','" + textBox3.Text.ToString() + "','" + listBox1.Text.ToString() + "'";
            SqlCommand cmd = new SqlCommand(@"insert into login(staffname,staffuname,staffpass,staffcategory) values(" + str + ")", conn);

            cmd.ExecuteNonQuery();
            conn.Close();
            MessageBox.Show("Staff Added Succesfully...!!");
            AdminPage a1 = new AdminPage();

            a1.Show();
            this.Hide();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection("Server=.\\SQLEXPRESS; Database= ExamManager;Integrated Security =true");

            conn.Open();
            SqlCommand    cmd = new SqlCommand("select * from login where adminusername='******' ", conn);
            SqlDataReader dr  = cmd.ExecuteReader();

            if (dr.Read())
            {
                if ((textBox1.Text.ToString() == dr.GetString(0).ToString()) && (textBox2.Text.ToString() == dr.GetString(1).ToString()))
                {
                    AdminPage a1 = new AdminPage();
                    a1.Show();
                    this.Hide();
                }
            }
            conn.Close();
        }