Guest User

Untitled

a guest
Mar 18th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 Orar3
  13. {
  14.     public partial class OrarLogin : Form
  15.     {
  16.         public OrarLogin()
  17.         {
  18.             InitializeComponent();
  19.            
  20.         }
  21.  
  22.         private void button1_Click(object sender, EventArgs e)
  23.         {
  24.             this.Close();
  25.         }
  26.  
  27.         private void MinimizeButton_Click(object sender, EventArgs e)
  28.         {
  29.             this.WindowState = FormWindowState.Minimized;
  30.         }
  31.  
  32.         private void MaximizeButton_Click_1(object sender, EventArgs e)
  33.         {
  34.  
  35.             if (this.WindowState == FormWindowState.Normal)
  36.                 this.WindowState = FormWindowState.Maximized;
  37.  
  38.             else
  39.                 this.WindowState = FormWindowState.Normal;
  40.         }
  41.  
  42.         private void LoginButton_Click(object sender, EventArgs e)
  43.         {
  44.  
  45.             SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Andrei\Desktop\LogIn Files SQL\LogInData.mdf;Integrated Security=True;Connect Timeout=30;");
  46.             SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From Login where USERNAME='" + UsernameBox.Text + "' and PASSWORD='" + PasswordBox.Text + "'", con);
  47.             DataTable dt = new DataTable();
  48.  
  49.             sda.Fill(dt);
  50.  
  51.             if (dt.Rows[0][0].ToString() == "1")
  52.             {
  53.                 this.Hide();
  54.                 OrarMenu menu = new OrarMenu();
  55.                 menu.Show();
  56.             }
  57.  
  58.             else
  59.                 MessageBox.Show("Greseala, te rog incearca inca o data");
  60.         }
  61.  
  62.        
  63.    
  64.     }
  65. }
Add Comment
Please, Sign In to add comment