Ver Mensaje Individual
  #6 (permalink)  
Antiguo 31/10/2008, 04:49
Avatar de Cameron_2006
Cameron_2006
 
Fecha de Ingreso: diciembre-2006
Mensajes: 248
Antigüedad: 17 años, 4 meses
Puntos: 0
Respuesta: validar que un registro no esté duplicado antes de insertar datos

Gracias a todos por ayudarme en este caso, ya está solucionado. con esta función:


<% function Existe (NroRef)
dim sSql
dim RsK
dim Rpta
Rpta=False
set RsK=server.CreateObject("ADODB.RecordSet")
Ssql="select COUNT(*) from inmuebles where ref_inmueble='" & NroRef &"'"
rsK.open Ssql,conn,1,2
if not rsK.EOF then
if not isnull(RsK(0)) then
if cint(RsK(0))>0 then
Rpta=true
end if
end if
end if
Existe = Rpta
end function%>

La cual llame antes de insertar los datos, así:
if not Existe(ref_inmueble) then