Advertisement
SrJefers_Loading

consultas

Jun 7th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. String^ encontrado = (textBox1->Text);
  2. String^ conecto = L"datasource=localhost;port=3306;username=root;password=jeferson";
  3. MySqlConnection^ conDataBase = gcnew MySqlConnection(conecto);
  4. MySqlCommand^ cmdDataBase = gcnew MySqlCommand("select * from proyecto_bd.emp_nuevo WHERE emp_id = '" + textBox1->Text + "';", conDataBase);
  5. MySqlDataReader^ Lectura;
  6. try{
  7. conDataBase->Open();
  8. //cmdDataBase->Parameters->AddWithValue("@emp_id", textBox1->Text);
  9. //AND WHERE emp_id = '"+textBox1->Text+"' emp_id=@emp_id,
  10. Lectura = cmdDataBase->ExecuteReader();
  11. int count = 0;
  12. //label11->Text = textBox1->Text;
  13. //while (Lectura->Read())
  14. //{
  15. // count = count + 1;
  16. //tipo = Lectura->GetString("tipo");
  17. // }//
  18. //if (count == 1){
  19. MessageBox::Show("Encontrado.", "Buscando...", MessageBoxButtons::OK, MessageBoxIcon::Information);
  20. if (Lectura->Read())
  21. {
  22. String^ emp_idval = Lectura->GetInt32("emp_id").ToString();
  23. label11->Text = emp_idval;
  24. String^ emp_nombreval = Lectura->GetString("emp_nombre");//.ToString()
  25. label12->Text = emp_nombreval;
  26. String^ emp_apellidoval = Lectura->GetString("emp_apellido");
  27. label13->Text = emp_apellidoval;
  28. String^ emp_direccionval = Lectura->GetString("emp_direccion");
  29. label14->Text = emp_direccionval;
  30. String^ emp_dpival = Lectura->GetString("emp_dpi");
  31. label15->Text = emp_dpival;
  32. String^ emp_telefonoval = Lectura->GetString("emp_telefono");
  33. label16->Text = emp_telefonoval;
  34. String^ emp_puestoval = Lectura->GetString("emp_puesto");
  35. label17->Text = emp_puestoval;
  36. String^ emp_fechaingval = Lectura->GetString("emp_fechaing");
  37. label18->Text = emp_fechaingval;
  38. String^ emp_sallival = Lectura->GetDouble("emp_salli").ToString();
  39. label19->Text = emp_sallival;
  40. String^ emp_saltotval = Lectura->GetDouble("emp_saltot").ToString();
  41. label10->Text = emp_saltotval;
  42. }
  43.  
  44. /*}
  45. else if (count>1)
  46. {
  47. MessageBox::Show("ERROR!", "Acceso Denegado", MessageBoxButtons::OK, MessageBoxIcon::Stop);
  48. }
  49. else if (textBox1->Text == "")
  50. {
  51. MessageBox::Show("Deberias de ingresar el ID para poder buscar correctamente el registro...", "Falta algo... :(", MessageBoxButtons::OK, MessageBoxIcon::Stop);
  52. this->textBox1->Focus();
  53. }
  54. else
  55. {
  56. MessageBox::Show("El ID ingresado no ha podido ser encontrado en la base de datos.", "Algo salio mal D:", MessageBoxButtons::OK, MessageBoxIcon::Error);
  57. this->textBox1->Clear();
  58. this->textBox1->Focus();
  59. }*/
  60. }
  61. catch (Exception^ex){
  62.  
  63. MessageBox::Show(ex->Message);
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement