Beispiel #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            info inf = new info();

            inf.Show();
        }
        private void button4_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            info asd = new info();

            asd.Show();
        }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.textBox1.Text) || string.IsNullOrEmpty(this.textBox2.Text))
            {
                MessageBox.Show("provide User Name and Password");
            }

            SqlConnection con = new SqlConnection();

            con.ConnectionString = "Data Source=ANONYMOUS\\SQLEXPRESS;Initial Catalog=cdb;Integrated Security=True";
            con.Open();
            string         username = textBox1.Text;
            string         password = textBox2.Text;
            SqlCommand     cmd      = new SqlCommand("SELECT * FROM login WHERE username = '******' and password = '******' ", con);
            SqlDataAdapter da       = new SqlDataAdapter(cmd);
            DataTable      dt       = new DataTable();

            da.Fill(dt);

            System.Data.SqlClient.SqlDataReader dr = null;
            dr = cmd.ExecuteReader();


            if (dr.Read())
            {
                if (this.textBox1.Text == dr["username"].ToString() && this.textBox2.Text == dr["password"].ToString())
                {
                    //MessageBox.Show("*** Login Successful ***");
                    this.Visible = false;

                    info frm = new info();
                    frm.Show();
                }
            }

            else
            {
                // MessageBox.Show("Invalid UserName or Password", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show("Access Denied!!");
            }

            con.Close();
        }