Advertisement
Guest User

Untitled

a guest
Dec 15th, 2016
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Data.SqlClient;
  11.  
  12.  
  13. namespace WindowsFormsApplication1
  14. {
  15. public partial class LOGIN : Form
  16. {
  17. public LOGIN()
  18. {
  19. InitializeComponent();
  20. }
  21.  
  22. private void button2_Click(object sender, EventArgs e)
  23. {
  24. this.Close();
  25. }
  26.  
  27. private void button1_Click(object sender, EventArgs e)
  28. {
  29.  
  30. SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)v11.0;AttachDbFilename=C:UserskenluiDocumentsLoginDate.mdf;Integrated Security=True;Connect Timeout=30;");
  31. SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) from Login where Username ='" + textBox1.Text + "' and Password = '" + textBox2.Text + "'", con);
  32. DataTable dt = new DataTable();
  33. sda.Fill(dt);
  34. if (dt.Rows[0][0].ToString() == "1")
  35. {
  36. this.Hide();
  37. main ss = new main();
  38. ss.Show();
  39.  
  40.  
  41. }
  42. else
  43. {
  44. MessageBox.Show("Please Check Username and Password");
  45.  
  46.  
  47. }
  48.  
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement