Advertisement
Guest User

login xd

a guest
Jan 8th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 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.Windows.Forms;
  9. using MySql.Data.MySqlClient;
  10.  
  11.  
  12.  
  13. namespace Gestao_de_Venda_de_Peixe
  14. {
  15. public partial class Form8 : Form
  16. {
  17. private MySqlConnection mConn;
  18. private MySqlDataAdapter mAdapter;
  19. private DataSet mDataSet;
  20.  
  21. public Form8()
  22. {
  23. InitializeComponent();
  24. }
  25.  
  26. private void button1_Click(object sender, EventArgs e)
  27. {
  28. MySqlConnection mConn = new MySqlConnection("Persist Security Info=False;server=localhost;database=gestaodevendadepeixe;uid=root");
  29.  
  30. mConn.Open();
  31. MySqlCommand cmd = new MySqlCommand(" select * from login where Username='" + textBox1.Text + "'and PassWord='" + textBox2.Text + "'", mConn);
  32. MySqlDataReader dr;
  33. dr = cmd.ExecuteReader();
  34. int count = 0;
  35. while (dr.Read())
  36. {
  37. count += 1;
  38.  
  39. } if (count == 1)
  40. {
  41. MessageBox.Show("ok");
  42. Form9 f9 = new Form9();
  43. f9.Show();
  44. this.Visible = false;
  45. }
  46. else if (count > 1)
  47. {
  48. MessageBox.Show("error");
  49. }
  50. mConn.Close();
  51. }
  52.  
  53. private void textBox2_TextChanged(object sender, EventArgs e)
  54. {
  55.  
  56. }
  57.  
  58. private void Form8_Load(object sender, EventArgs e)
  59. {
  60.  
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement