Advertisement
Guest User

asdasd

a guest
May 7th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 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 WindowsFormsApp3
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void button1_Click(object sender, EventArgs e)
  22.         {
  23.             SqlConnection con = new SqlConnection(@"Data Source=87.254.161.7,1433;Initial Catalog=MuOnline;User ID=sa;Password=123456");
  24.             SqlDataAdapter sda = new SqlDataAdapter("SELECT Rank FROM Admins WHERE Username='"+ textBox1.Text +"' and Password='"+ textBox2.Text +"'",con);
  25.             DataTable dt = new System.Data.DataTable();
  26.             sda.Fill(dt);
  27.             if(dt.Rows.Count == 1)
  28.             {
  29.                 this.Hide();
  30.                 Main ss = new Main(dt.Rows[0][0].ToString());
  31.                 ss.Show();
  32.             }
  33.             else
  34.             {
  35.                 MessageBox.Show("Please Check your username or password");
  36.             }
  37.         }
  38.  
  39.         private void button2_Click(object sender, EventArgs e)
  40.         {
  41.             this.Close();
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement