public static string ObtieneNombreDeConductor(int id_conductor, int tipo_conductor) { string NombeConductor = ""; string reqSQL = ""; z_cuarteleros zcuarteleros = new z_cuarteleros(); z_voluntarios zvoluntarios = new z_voluntarios(); var myBase = new CnxBase(); var myD4MCnx = new CnxBase(); if (tipo_conductor == 1) { //reqSQL = "SELECT nombres||' '||apellidos As nombre_completo FROM z_cuarteleros WHERE id_cuartelero=" + id_conductor + ""; reqSQL = "SELECT nombres||' '||apellidos As nombre_completo FROM z_cuarteleros WHERE id_cuartelero IN (SELECT id_cuart_vol FROM z_conductores WHERE id_conductor=" + id_conductor + ")"; } else { reqSQL = "SELECT nombres||' '||apellidos As nombre_completo FROM z_voluntarios WHERE id_voluntario IN (SELECT id_cuart_vol FROM z_conductores WHERE id_conductor=" + id_conductor + ")"; } try { DataSet myResult = myD4MCnx.GetDataSet(reqSQL); foreach (DataRow r_conductor in myResult.Tables[0].Rows) { NombeConductor = Convert.ToString(r_conductor["nombre_completo"]); } } catch (Exception myErr) { throw (new Exception(myErr + reqSQL)); } return(NombeConductor); }
private void btnAceptar_Click(object sender, EventArgs e) { if (checkRefEspacial.Checked) { // verificar tabla if (!CnxBase.tablaExiste(textTabla.Text)) { MessageBox.Show("La tabla especificada no existe.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (textNombre.Text == "") { MessageBox.Show("No ha especificado un nombre.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Ingresar(); }