Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. String^ esto = L"datasource=localhost;port=3306;username=root;password=guateumg";
  2. MySqlConnection^ conexion = gcnew MySqlConnection(esto);
  3. MySqlCommand^ cmdBaseDato = gcnew MySqlCommand("select * from temp.empleado where nombre = '" + this->usuario_txt->Text + "' and contrasenia = '" + this->contrasenia_txt->Text + "';", conexion);
  4. MySqlDataReader^ Lectura;
  5.  
  6. try{
  7. conexion->Open();
  8. Lectura = cmdBaseDato->ExecuteReader();
  9. int contador = 0;
  10.  
  11. while (Lectura->Read())
  12. {
  13. contador=1;
  14.  
  15. if (contador == 1)
  16. {
  17. MessageBox::Show("Datos Ingresados Correctamente","Informacion");
  18. Administrador^ Admin = gcnew Administrador(); //va al otro form
  19. Admin->Show();
  20. }
  21. }
  22. if (contador == 0)
  23. {
  24. MessageBox::Show("Alguno Datos No Concuerdan Con Nuestra Base De Datos","Informacion");
  25. usuario_txt->Clear();
  26. contrasenia_txt->Clear();
  27. }
  28.  
  29. }
  30. catch (Exception^ error){
  31. MessageBox::Show(error->Message);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement