Advertisement
N-am

Untitled

Jul 10th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 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 MySql.Data.MySqlClient;
  11.  
  12. namespace WindowsFormsApplication3
  13. {
  14. public partial class Form1 : Form
  15. {
  16. MySqlConnection conexion = new MySqlConnection("Server=localhost;Database=test;username=root;password=")
  17. public Form1()
  18. {
  19.  
  20. InitializeComponent();
  21. }
  22.  
  23. private void button1_Click(object sender, EventArgs e)
  24. {
  25. conextion.Open();
  26. MessageBox.Show("Debug 1");
  27. MySqlCommand cmd = new MySqlCommand("SELECT * FROM users WHERE Name = '"+ username.Text+"' AND Password = '"+ password.Text+"' ");
  28. MySqlDataReader leer = cmd.ExecuteReader();
  29. MessageBox.Show("Debug 2");
  30. if (leer.Read())
  31. MessageBox.Show("Succes");
  32. else
  33. MessageBox.Show("Fail haha :))");
  34. conextion.Close();
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement