Advertisement
Guest User

Untitled

a guest
Oct 7th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public partial class Form1 : MetroFramework.Forms.MetroForm
  2. {
  3. public Form1()
  4. {
  5. InitializeComponent();
  6. }
  7. SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)v11.0;AttachDbFilename=C:UsersIgurekDocumentsDatabase.mdf;Integrated Security=True;Connect Timeout=30");
  8. private void metroButton1_Click(object sender, EventArgs e)
  9. {
  10. this.Close();
  11. }
  12.  
  13. private void metroButton2_Click(object sender, EventArgs e)
  14. {
  15. SqlDataAdapter sdf = new SqlDataAdapter("Select Count(*) From Login where Username='" + metroTextBox1.Text + "' and Password='" + metroTextBox2.Text + "'", con);
  16. DataTable dt = new DataTable();
  17.  
  18.  
  19. sdf.Fill(dt); // <--------- Here's the exception
  20. if (dt.Rows.Count == 1)
  21. {
  22. Form1 f1 = new Form1();
  23. f1.Show();
  24.  
  25. }
  26. else
  27. {
  28. MessageBox.Show("Sprawdz Nazwe i Haslo");
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement