private void LoginButton_Click(object sender, EventArgs e) { //string hostName = System.Net.Dns.GetHostName(); //SqlConnection con = new SqlConnection(@"Data Source=" + hostName + "\\SQLEXPRESS;Initial Catalog=TickSys;Integrated Security=True"); //con.Open(); SqlConnection con = Database.Instance().Connection; SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM dbo.Users WHERE username='******' AND passwd='" + Loginpass.Text + "'", con); DataSet ds = new DataSet(); DataTable dt = new DataTable("dbo.Users"); sda.Fill(dt); if (dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == "1") { MessageBox.Show("U bent succesvol ingelogd. Welkom !"); this.Hide(); new TicketSysteem().Show(); } else { MessageBox.Show("Uw gebruikersnaam of wachtwoord is incorrect."); } }