Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String^ encontrado = (textBox1->Text);
- String^ conecto = L"datasource=localhost;port=3306;username=root;password=jeferson";
- MySqlConnection^ conDataBase = gcnew MySqlConnection(conecto);
- MySqlCommand^ cmdDataBase = gcnew MySqlCommand("select * from proyecto_bd.emp_nuevo WHERE emp_id = '" + textBox1->Text + "';", conDataBase);
- MySqlDataReader^ Lectura;
- try{
- conDataBase->Open();
- //cmdDataBase->Parameters->AddWithValue("@emp_id", textBox1->Text);
- //AND WHERE emp_id = '"+textBox1->Text+"' emp_id=@emp_id,
- Lectura = cmdDataBase->ExecuteReader();
- int count = 0;
- //label11->Text = textBox1->Text;
- //while (Lectura->Read())
- //{
- // count = count + 1;
- //tipo = Lectura->GetString("tipo");
- // }//
- //if (count == 1){
- MessageBox::Show("Encontrado.", "Buscando...", MessageBoxButtons::OK, MessageBoxIcon::Information);
- if (Lectura->Read())
- {
- String^ emp_idval = Lectura->GetInt32("emp_id").ToString();
- label11->Text = emp_idval;
- String^ emp_nombreval = Lectura->GetString("emp_nombre");//.ToString()
- label12->Text = emp_nombreval;
- String^ emp_apellidoval = Lectura->GetString("emp_apellido");
- label13->Text = emp_apellidoval;
- String^ emp_direccionval = Lectura->GetString("emp_direccion");
- label14->Text = emp_direccionval;
- String^ emp_dpival = Lectura->GetString("emp_dpi");
- label15->Text = emp_dpival;
- String^ emp_telefonoval = Lectura->GetString("emp_telefono");
- label16->Text = emp_telefonoval;
- String^ emp_puestoval = Lectura->GetString("emp_puesto");
- label17->Text = emp_puestoval;
- String^ emp_fechaingval = Lectura->GetString("emp_fechaing");
- label18->Text = emp_fechaingval;
- String^ emp_sallival = Lectura->GetDouble("emp_salli").ToString();
- label19->Text = emp_sallival;
- String^ emp_saltotval = Lectura->GetDouble("emp_saltot").ToString();
- label10->Text = emp_saltotval;
- }
- /*}
- else if (count>1)
- {
- MessageBox::Show("ERROR!", "Acceso Denegado", MessageBoxButtons::OK, MessageBoxIcon::Stop);
- }
- else if (textBox1->Text == "")
- {
- MessageBox::Show("Deberias de ingresar el ID para poder buscar correctamente el registro...", "Falta algo... :(", MessageBoxButtons::OK, MessageBoxIcon::Stop);
- this->textBox1->Focus();
- }
- else
- {
- MessageBox::Show("El ID ingresado no ha podido ser encontrado en la base de datos.", "Algo salio mal D:", MessageBoxButtons::OK, MessageBoxIcon::Error);
- this->textBox1->Clear();
- this->textBox1->Focus();
- }*/
- }
- catch (Exception^ex){
- MessageBox::Show(ex->Message);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement