Ver Mensaje Individual
  #6 (permalink)  
Antiguo 02/09/2005, 16:42
Avatar de HPNeo
HPNeo
 
Fecha de Ingreso: mayo-2004
Ubicación: The Matrix
Mensajes: 223
Antigüedad: 20 años
Puntos: 0
Bien, bien... no he podido responder antes porque estoy en examenes parciales, lo siento, pero asi es el colegio.

Aqui esta la solucion:
Código:
<html> 
<head> 
</head> 
<body> 
<!-- Conecto mi base de datos---> 
<% 
Dim cnOra1, cnStrOra ,Rs, sql, SQL1 
Set cnOra1 = Server.CreateObject("ADODB.Connection") 
set Rs=Server.CreateObject("ADODB.Recordset") 
cnOra1.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("nepo.mdb") 
 
sql="select * from personal " 
 
Rs.Open sql, cnOra1 
' Capturo el valor de mi lista_desplegable en la variable iEmpleado 
iEmpleado=Request.Form("Empleado")
if iEmpleado="" then 'si la variable iEmpleado esta vacia se muestra solo el formulario
%>
<!-- Inicio de formulario--> 
<form method="POST" action="prueba.asp"> 
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="669" id="AutoNumber1" height="291"> 
<tr> 
<td width="665" colspan="5" height="1"><font face="Arial" size="2">Empleado:&nbsp; &nbsp;</font> 
<select size="1" name="Empleado" > 
<!--Mi lista toma valores de mi base de datos (tabla personal)---> 
<% total=0 
while not Rs.EOF 
%> 
<option value="<%=Rs("codi_empl_per")%>"><%=Rs("ape_pat_per")%>&nbsp;&nbsp;<%=Rs("ape_mat_per")%>&nbsp;&nbsp;<%=Rs("nom_emp_per")%></option> 
<% Rs.movenext 
	 total= total+1 
	 wend 
%> 
</select>&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit" value="Enviar" name="B1"> 
</form> 
<!--Fin de Formulario-->
</tr>
<%
else
Rs.close 
if Request.Form("Empleado")<>"" then 
	 sql = sql + "where codi_empl_per="&iEmpleado &"" 
end if 
response.write(sql) 
Rs.Open sql, cnOra1 
response.write(iEmpleado)
 
if Rs.State <>0 then 
if not (Rs.BOF and Rs.EOF) then 
total=0 
do while not Rs.EOF 
total=total+1 
%>
<tr> 
<td width="306" height="24"><font size="2" face="Arial">DNI:&nbsp; 
</font></td> 
<td width="194" height="24"><%=Rs("codi_empl_per")%></td> 
<td width="134" height="24">&nbsp;</td> 
</tr> 
<tr> 
<td width="665" colspan="5" height="50"> 
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber10" height="1"> 
<tr> 
<td width="12%" height="1"><font size="2" face="Arial">Domicilio:</font></td> 
<td width="88%" height="1"></td> 
</tr> 
</table> 
</td> 
</tr> 
<tr> 
<td width="665" colspan="5" height="48"> 
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3" height="43">
	 <tr> 
<td width="33%" height="16"><font size="2" face="Arial">Distrito: <%=Rs("dist_naci_tdi")%></font></td> 
<td width="33%" height="16"><font size="2" face="Arial">Provincia: <%=Rs("prov_naci_tpr")%></font></td> 
<td width="34%" height="16"><font size="2" face="Arial">Departamento: <%=Rs("depa_naci_dpt")%></font></td> 
</tr> 
<tr> 
		<td width="33%" height="21">&nbsp;</td> 
		<td width="33%" height="21">&nbsp;</td> 
		<td width="34%" height="21">&nbsp;</td> 
</tr> 
</table> 
<% 
Rs.movenext 
loop 
%> 
</td> 
</tr>
<!--Cierro mi conexion de base de datos---> 
<% 
else
Rs.close 
Set rs= Nothing 
cnOra1.close 
Set cnOra1= Nothing 
end if
end if
end if 
%> 
</table> 
</body>
</html>
Hubo un error en el orden de la ejecucion de la segunda sentencia sql, y ahora mira lo que esta en celeste: sino se selecciona ningun registro, no aparece nada y ya no se muestran los miles de registros que tiene la tabla.

Espero tus comentarios
Saludos

P.D.: He cambiado el nombre de la tabla, y la sentencia sql podria ser:
sql = sql + "where codi_empl_per='"&iEmpleado &"'"
__________________
HPNeo