Exemple #1
0
        private void metroLink1_Click(object sender, EventArgs e)
        {
            DashboardForm dashboardForm = new DashboardForm();

            dashboardForm.Show();
            this.Hide();
        }
        //LogIn Button
        private void metroLink1_Click(object sender, EventArgs e)
        {
            string hashpw;
            string benutzer = usernameTextBox.Text;

            hashpw = GetMD5Hash(passwordTextBox.Text);

            //Recordset
            ADODB.Connection cn = new ADODB.Connection();
            ADODB.Recordset  rs = new ADODB.Recordset();
            string           cnStr;

            try
            {
                //Connection string.
                cnStr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=PPS-Datenbank.mdb";
                cn.Open(cnStr);

                rs.Open("Select * From Login where benutzer ='" + usernameTextBox.Text + "';", cn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, -1);

                if (rs.Fields["passwort"].Value == hashpw)
                {
                    dashboardForm = new DashboardForm();
                    dashboardForm.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Falsches Passwort!");
                }
            }
            catch (Exception fehler)
            {
                MessageBox.Show("Logindaten sind nicht korrekt" + fehler);
            }
            finally
            {
                cn.Close();
            }
        }