Advertisement
Guest User

Untitled

a guest
Nov 15th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 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. namespace OODB
  13. {
  14. public partial class Register : Form
  15. {
  16. public Register()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23. SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\boby\Desktop\OODB\OODB\Database1.mdf;Integrated Security=True");
  24. SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From dbo where Username='" + textBox1.Text + "' and Password= '" + textBox2.Text + "'" + con);
  25. DataTable dt = new DataTable();
  26. sda.Fill(dt);
  27. if (dt.Rows[0][0].ToString() == "1")
  28. {
  29. Form f = new P1();
  30. f.Show();
  31. Hide();
  32. }
  33. else
  34. {
  35. MessageBox.Show("Sorry");
  36. }
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement