private void btnZurück_Click(object sender, EventArgs e) { this.Hide(); frmHauptmenue fH = new frmHauptmenue(); fH.Show(); }
private void btnLogin_Click(object sender, EventArgs e) { SqlDataAdapter sqlDa = new SqlDataAdapter(); DataTable dt = new DataTable(); SqlCommand cmd = new SqlCommand(); string cmdStr = ""; using (SqlConnection sqlConn = new SqlConnection(Helper.CnnVal("loginDB"))) { cmdStr = "select * from userdata where login = @login collate latin1_general_cs_as and passwort = @passwort " + "collate latin1_general_cs_as"; cmd = new SqlCommand(cmdStr, sqlConn); cmd.Parameters.AddWithValue("@login", txtLogin.Text); cmd.Parameters.AddWithValue("@passwort", txtPassword.Text); sqlDa.SelectCommand = cmd; dt = new DataTable(); sqlDa.Fill(dt); if (dt.Rows.Count == 1) { Login.BenutzerAktuell = txtLogin.Text; Login.KontoTyp = GetKontoTyp(txtLogin.Text); this.Hide(); frmHauptmenue fH = new frmHauptmenue(); if (!FormCheckOpened(fH.Name)) { fH.Show(); } } else { MessageBox.Show("Ungültige Login / Passwort.", "Information"); } } }