Drop down list y textbox
Publicado por Danny Garro Arroyo (1 intervención) el 31/01/2014 20:04:29
tengo un drop down list y segun lo que se seleccione tiene q cargar 2 datos en textbox diferentes pero tiene q pasar por una tabla donde agarra un id y segun ese id pasa a otra tabla y agarra los datos que tengan la id igual
tengo este procedimiento pero no me sirve, que tengo mal?
public void cargarDatos(string id)
{
try
{
using (DinamicaEntities entities = new DinamicaEntities())
{
var E = (from p in entities.Choferes
where p.Pasaporte == id
select p).FirstOrDefault();
var V = (from x in entities.Vehiculo
where x.Idvehiculo == E.Idvehiculo
select x).FirstOrDefault();
if (V != null)
{
txtCabezal.Text = V.Cabezal;
txtFurgon.Text = V.Furgon;
}
}
}
catch(Exception ex)
{
}
}
tengo este procedimiento pero no me sirve, que tengo mal?
public void cargarDatos(string id)
{
try
{
using (DinamicaEntities entities = new DinamicaEntities())
{
var E = (from p in entities.Choferes
where p.Pasaporte == id
select p).FirstOrDefault();
var V = (from x in entities.Vehiculo
where x.Idvehiculo == E.Idvehiculo
select x).FirstOrDefault();
if (V != null)
{
txtCabezal.Text = V.Cabezal;
txtFurgon.Text = V.Furgon;
}
}
}
catch(Exception ex)
{
}
}
Valora esta pregunta


0