Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/01/2008, 07:36
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 18 años, 4 meses
Puntos: 126
Re: como saber si el dato se encuentra en la tabla

Hola rezocrew

Pongamos por caso que tienes un archivo llamado ingresos.asp. Este archivo ha de constar con algo así

Código PHP:
 <%
Dim vac
vac 
Request.Form("vacio")
IF 
vac "" then
%>
<
form name="f" id="f" action="./ingresos.asp" method="post">
<
input type="text" value="" name="rut" />
<
input type="hidden" value="1" name="vacio" />
<
input type="submit" value="Codificar" />
</
form>
<%
ELSE
Dim ruta
ruta 
Request.Form("rut")


SQL="Select campo from tabla where campo =   '"&ruta&"'"
rs.Open SQLoConn0,1
if not rs.eof then
%>
Esta ruta ya existe
<%
else
SQL="INSERT INTO tabla (campo) VALUES ('"&ruta&"');"
oConn.Execute(SQL)
%>
Ruta no repetida
<%
end if
END IF
%> 
Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />