Foros del Web » Programando para Internet » ASP Clásico »

como hacer que haga un select en asp en el onchange() ?

Estas en el tema de como hacer que haga un select en asp en el onchange() ? en el foro de ASP Clásico en Foros del Web. pues tengo una duda, como puedo hacer que en un input al darle enter vaya y me haga una busqueda de una tabla en SQL ...
  #1 (permalink)  
Antiguo 16/10/2007, 17:11
Avatar de Gaby_Corr  
Fecha de Ingreso: junio-2005
Mensajes: 672
Antigüedad: 19 años, 11 meses
Puntos: 0
como hacer que haga un select en asp en el onchange() ?

pues tengo una duda, como puedo hacer que en un input al darle enter vaya y me haga una busqueda de una tabla en SQL

tengo mi input de esta forma:

<input name="sistemas" type="text" id="sistemas" value="" size="20" maxlength="20" onChange="buscar()" />

funcion buscar:
Código:
<%
   call conectarDB
   
   Dim sSQL, rs
   
   sSQL = "Select sistemas_id, sistemas_nombre, sistemas_linea FROM DS_Sistemas where sistemas_id = '"& sistemas &"'"
   rs = cnn.execute(sSQL)
   
.......
.....
....
   call desconectarDB
%>
aparte como puedo hacer q al iniciar la pagina unos botones no se encuentren visibles y ya despues que haga unas validaciones si los aparezca?
__________________
" Recuerda , estas donde debes estar ..."
  #2 (permalink)  
Antiguo 16/10/2007, 22:26
Avatar de Shiryu_Libra
Colaborador
 
Fecha de Ingreso: febrero-2007
Ubicación: Cantando "Screenager" en "Kirafa Kaput"
Mensajes: 3.614
Antigüedad: 18 años, 2 meses
Puntos: 88
Re: como hacer que haga un select en asp en el onchange() ?

gaby:


buscar.asp
Código PHP:
<&#37;
function buscar()
   
call conectarDB
   
   Dim sSQL
rs
   
   sSQL 
"Select sistemas_id, sistemas_nombre, sistemas_linea FROM DS_Sistemas where sistemas_id = '"sistemas &"'"
   
rs cnn.execute(sSQL)
   
.......
.....
....
   
call desconectarDB
end 
function
 
if 
request.servervariables("REQUEST_METHOD")="POST" and request.form("metodo")="buscar" then
call buscar
()
 
else
%>
<
html>
<
body>
<
form action="buscar.asp" method="post">
<
input type="hidden" value="buscar" name="metodo">
<
input name="sistemas" type="text" id="sistemas" value="" size="20" maxlength="20" onChange="buscar()" />
</
form>
</
body>
</
html>
<%
end if%> 
te serviria esto???
__________________
"Eres parte del problema, parte de la solucion o parte del paisaje"
Un Saludo desde Desierto de Altar, Sonora, MX.
Shiryu_libra
  #3 (permalink)  
Antiguo 17/10/2007, 09:55
Avatar de Gaby_Corr  
Fecha de Ingreso: junio-2005
Mensajes: 672
Antigüedad: 19 años, 11 meses
Puntos: 0
Re: como hacer que haga un select en asp en el onchange() ?

mm no se que estoy haciendo, pero algo esta mal

intente hacer esto, aver que tal

Código PHP:
<!-- #include file="../conexion.asp"-->

<%

    function 
grabar(sistema,nombre,linea)
      
call conectarDB
       sSQL 
"Insert into DS_sistemas(sistemas_id, sistemas_nombre, sistemas_linea) VALUES('"sistema &"','"nombre &"','"linea &"')"
       
cnn.Execute(SSQL)
       
call desconectarDB      
    end 
function
    
    
    function 
buscar()      
       
call conectarDB
       Dim sSQL
rs
       
       sSQL 
"Select sistemas_id, sistemas_nombre, sistemas_linea FROM DS_Sistemas where sistemas_id = '"sistemas &"'"
       
Set rs cnn.execute(sSQL)         
       
call desconectarDB 
    end 
function
    


if 
request.servervariables("REQUEST_METHOD")="POST" and request.form("guardar")="guardar" then
call grabar
() 
else
%>

<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>Sistemas</title>


<
script language="JavaScript" type="text/javascript">
<!--
function 
mostrarboton()
{
 
document.getElementById("guardar").style.visibility "visible";
}
//-->
</script>
</head>

<body>
<div id="contenedor_pet">
                <form method="post" action="sistemas.asp" id="form1" name="form1">
                
                    <table width="100%" cellpadding="0" cellspacing="0">            
                        <tr><td>Número de Sistema: <br /><span class="dtobligatorio"> * </span>
                            <input name="sistemas" type="text" id="sistemas" value="" size="20" maxlength="20" onchange="mostrarboton()" /><!--onkeyup="javascript: location.href='sistemas.asp?strmostrar=1';"  -->
                            <input name="ver" type="image" id="ver" value="Ver" src="Images/20_VER1.jpg" /><!-- onchange="buscar()" window.open('peticion.asp','gab','')--></td></tr>
                            <input type="hidden" value="buscar" name="metodo">
                            
                        <tr><td>Nombre del sistema: <br /><span class="dtobligatorio"> * </span>
                           <input name="nombre" type="text" id="nombre" value="" size="95" maxlength="30" />
                        </td>
                        </tr>
                        <tr><td>Línea de sistemas:<br /><span class="dtobligatorio"> * </span>
                        <input name="linea" type="text" id="linea" value="" size="95" maxlength="30" /> </td></tr>
                        
                        <tr><td><br /><br /></td></tr>                        
                        <tr><td>
                               <table align="left">
                                <tr>
                                    <td width="167" height="36">
                                            <div style=" visibility: hidden;"><input name="guardar" type="image" id="guardar" src="images/GUARDAR1.gif" onclick="guardar(sistema,nombre,linea)" />
                                                  <input name="guardar" type="hidden" id="guardar" value="1" />
                                                   </div>
                                            
                                    </td>
                                    <td width="167" height="36">
                                           <div style=" visibility: hidden;"><input name="modificar" type="image" id="modificar" src="images/modificar1.gif" />
                                                  <input name="modificar" type="hidden" id="modificar" value="1" />
                                                  </div> 
                                            
                                    </td>
                                    <td width="159">
                                            <div style=" visibility: hidden;"><input name="borrar" type="image"  id="borrar" src="Images/ELIMINAR1.gif"/></div></td>
                                    <td width="72"> 
                                        <div style=" visibility: hidden;"><a href="#" target="_blank" ><img src="images/IMPRIMIR1.gif" alt="Catalogo" name="imprimir" id="imprimir" width="113" height="32" border="0"  /></a></div></td>
                                </tr>
                              
                               <tr><td class="dtobligatorio"><br /><br />(*) Datos obligatorios</td></tr>
                            </table>
                        </td></tr>
                    </table>
                </form>
            </div> 




</body>
</html>

<% end if%> 

lo que intento hacer primero es habilitar el boton, lleno los campos y al darle click en boton guardar, que me llame a la funcion guardar() y que vaya y me inserte ese registro en la tabla, pero no lo hace =(

q puede ser?
__________________
" Recuerda , estas donde debes estar ..."
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:06.