Ver Mensaje Individual
  #90 (permalink)  
Antiguo 16/01/2006, 16:15
Avatar de a n g e l u s
a n g e l u s
 
Fecha de Ingreso: enero-2006
Ubicación: Chile
Mensajes: 237
Antigüedad: 18 años, 3 meses
Puntos: 1
FUNCION PARA BUSCAR EL ULTIMO REGISTRO INGRESADO EN LA BD, BASTANTE UTIL

ASI SE LLAMA
ultimodato = sqlmaximo(campo, tabla)

campo = corresponde autonumerico
tabla = tabla que buscas el ultimo registro ingresado

ESTA ES LA FUNCION

Function sqlmaximo( campo, tabla )
on error resume next
sql = "select max("&campo&") as maximo from "&tabla
set rsmax = db.execute(sql)
if err <> 0 then
Response.Write("ERROR :"&err.description&"<hr>")
else
if not rsmax.eof then
sqlmaximo = rsmax("maximo")
end if
rsmax.close
End Function
__________________
Atte,
A n g e l u s
Concepción - Chile
más vale respuestas bien pensadas, que 7000 post