daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Sep 26th, 2016 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public partial class Form1 : Form
  2.     {
  3.         public string str = @"Data Source=DESKTOP-9I02IE1;Initial Catalog = trabalhoC#;Integrated Security=True;Pooling=False";
  4.         public Form1()
  5.         {
  6.             InitializeComponent();
  7.         }
  8.  
  9.         private void button2_Click(object sender, EventArgs e)
  10.         {
  11.             MessageBox.Show("Adeus!");
  12.             this.Close();
  13.         }
  14.  
  15.         private void button1_Click(object sender, EventArgs e)
  16.         {
  17.             SqlConnection sc = new SqlConnection(str);        
  18.             SqlDataAdapter sda = new SqlDataAdapter();
  19.             DataSet ds = new DataSet();
  20.             sda.SelectCommand = new SqlCommand("Select username,password from utilizadores where username = '"+textBox1.Text.ToString()+"' and password = '"+textBox2.Text.ToString() + "' ");
  21.             sc.Open();
  22.             sda.Fill(ds);
  23.             if (ds.Tables[0].Rows.Count>0)
  24.             {
  25.                 Form2 f = new Form2();
  26.                 f.Show();
  27.             }
  28.             else
  29.             {
  30.                 MessageBox.Show("utilizador ou password incorrectas");
  31.             }
  32.             sc.Close();
  33.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top