예제 #1
0
 private void Login_Load(object sender, EventArgs e)
 {
     if (!KendaliParameter.databaseTidakKosong())
     {
         KoneksiDB.Close();
         Form Utama = new Utama();
         Utama.Show();
         this.Close();
     }
 }
        private void button4_Click(object sender, EventArgs e)
        {
            labelGagal.Text = "";
            OleDbDataAdapter    DataAdapter    = new OleDbDataAdapter("SELECT * from Akun where nama='" + textNama.Text + "' and passkode='" + textPwd.Text + "'", Connection);
            OleDbCommandBuilder CommandBuilder = new OleDbCommandBuilder(DataAdapter);
            DataTable           DataTabel      = new DataTable();

            try
            {
                DataAdapter.Fill(DataTabel);
                if (DataTabel.Rows.Count == 1)
                {
                    Connection.Close();
                    Form Utama = new Utama();

                    if (state)
                    {
                        state = false;
                        this.Close();
                    }
                    else
                    {
                        Keluar.PerformClick();
                    }
                }
                else
                {
                    labelGagal.Text = "Kombinasi tidak tepat.";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DataTabel.Clear();
                Connection.Close();
            }
        }
예제 #3
0
 private void BtnMasuk_Click(object sender, EventArgs e)
 {
     if ((TxtUname.Text != "") && (Txtpwd.Text != ""))
     {
         try
         {
             KoneksiDB.Open();
             DataAdapter = new OleDbDataAdapter("SELECT * from Akun where nama='" + TxtUname.Text + "' and passkode='" + Txtpwd.Text + "'", KoneksiDB);
             OleDbCommandBuilder CommandBuilder = new OleDbCommandBuilder(DataAdapter);
             DataAdapter.Fill(DataTabel);
             if (DataTabel.Rows.Count == 1)
             {
                 KendaliParameter.akunAktif = TxtUname.Text;
                 Form Utama = new Utama();
                 Utama.Show();
                 this.Hide();
             }
             else
             {
                 MessageBox.Show("Username dan Password tidak Valid...!!!");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         finally
         {
             KoneksiDB.Close();
         }
     }
     else
     {
         MessageBox.Show("Silakan masukkan informasi login!");
     }
 }