private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text != "" && txtPassword.Text != "")
            {
                OleDbDataReader rdr = null;
                {
                    string sql = string.Format("select * from tb_user where username = '******' and password = '******'", txtUsername.Text, txtPassword.Text);
                    OleDbConnection conn = new OleDbConnection(connectionString);
                    conn.Open();
                    OleDbCommand cmd = new OleDbCommand(sql, conn);
                    rdr = cmd.ExecuteReader();
                    if (rdr.Read())
                    {
                        nm = rdr[1].ToString();
                        pas = rdr[3].ToString();
                        MessageBox.Show("Loading....");
                        if (nm == "tiasore" && pas == "tiasore2012")
                        {
                            FrTransaksi tran = new FrTransaksi();
                            tran.Show();
                            this.Hide();
                        }
                        else if (nm == "admin" && pas == "adminserver")
                        {
                            index index = new index();
                            index.Show();
                            this.Hide();
                        }

                    }
                    else
                    {
                        txtUsername.Text = "";
                        txtUsername.Focus();
                        txtPassword.Text = "PASSWORD";
                        MessageBox.Show("Username atau Password Salah........ !", "Informasi" , MessageBoxButtons.OK, MessageBoxIcon.Information , MessageBoxDefaultButton.Button1);
                        lblarrow.Location = new Point(119, 284);

                    }

                    conn.Close();
                }
            }
            else
            {
                txtUsername.Text = "";
                txtUsername.Focus();
                txtPassword.Text = "PASSWORD";
                MessageBox.Show("Maaf, Lengkapi Username dan Password terlebih dahulu..!!!", "Informasi" , MessageBoxButtons.OK, MessageBoxIcon.Information , MessageBoxDefaultButton.Button1);
                lblarrow.Location = new Point(119, 284);
            }
        }
Beispiel #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text != "" && txtPassword.Text != "")
            {
                OleDbDataReader rdr = null;
                {
                    string          sql  = string.Format("select * from tb_user where username = '******' and password = '******'", txtUsername.Text, txtPassword.Text);
                    OleDbConnection conn = new OleDbConnection(connectionString);
                    conn.Open();
                    OleDbCommand cmd = new OleDbCommand(sql, conn);
                    rdr = cmd.ExecuteReader();
                    if (rdr.Read())
                    {
                        nm  = rdr[1].ToString();
                        pas = rdr[3].ToString();
                        MessageBox.Show("Loading....");
                        if (nm == "tiasore" && pas == "tiasore2012")
                        {
                            FrTransaksi tran = new FrTransaksi();
                            tran.Show();
                            this.Hide();
                        }
                        else if (nm == "admin" && pas == "adminserver")
                        {
                            index index = new index();
                            index.Show();
                            this.Hide();
                        }
                    }
                    else
                    {
                        txtUsername.Text = "";
                        txtUsername.Focus();
                        txtPassword.Text = "PASSWORD";
                        MessageBox.Show("Username atau Password Salah........ !", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                        lblarrow.Location = new Point(119, 284);
                    }

                    conn.Close();
                }
            }
            else
            {
                txtUsername.Text = "";
                txtUsername.Focus();
                txtPassword.Text = "PASSWORD";
                MessageBox.Show("Maaf, Lengkapi Username dan Password terlebih dahulu..!!!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                lblarrow.Location = new Point(119, 284);
            }
        }