Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/05/2005, 15:00
kg2875
 
Fecha de Ingreso: julio-2004
Mensajes: 25
Antigüedad: 20 años, 10 meses
Puntos: 0
Recuperar Informacion de Base de Datos

Estoy intentando hacer una consulta a la base datos y que me muestre los resultados en cuadros de texto.

Tengo un select, un boton y dos cuadros de texto quisiera que al hacer click en el boton capture el valor del select y

ejecute una consulta con el parametro capturado del select y que luego los muestre en los cuadros de texto.

He probado lo siguiente:

<FORM METHOD="post" ACTION="consulta_anps.asp" id=form name=form>
<table width="695" border="0" align="center">
<tr>
<td width="358" height="21">
<select name="ddlb_anp">
<OPTION selected value="Seleccione ANP">Seleccione el ANP
<option value="BPALED">BPALED
<option value="BPALTO">BPALTO
<option value="BPPAGA">BPPAGA
<option value="BPPUQU">BPPUQU
</select>
</td>
<td width="327" height="21">
<input type="submit" name="Submit" value="Buscar">

<%
Dim sAnp, Conn, Rs

sAnp=Request("ddlb_anp")

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "BDCDEB"
sSql = "select categoria, base_legal from areas where id_anp = '"&sAnp&"'"
set Rs = Conn.Execute(sSql)

if Not Rs.EOF then
Request.form("txt_categoria")=Rs("categoria")
Request.form("txt_base_legal")=Rs("base_legal")
end if
Rs.close
Conn.Close
%>
</td>
</tr>

</table>
<table width="695" border="1" align="center">
<tr>
<td>Categoria</td>
<td><input name="txt_categoria" type="text" id="txt_categoria"></td>
</tr>
<tr>
<td>Base Legal </td>
<td><input name="txt_base_legal" type="text" id="txt_base_legal"></td>
</tr>
</table>
</Form>

Desde ya Muchas Gracias por cualquier sugerencia y/o ayuda.

Saludos.