Ver Mensaje Individual
  #11 (permalink)  
Antiguo 09/04/2008, 10:11
Avatar de mc_quake
mc_quake
 
Fecha de Ingreso: enero-2006
Ubicación: www.ecocargo.cl
Mensajes: 683
Antigüedad: 19 años, 3 meses
Puntos: 8
Re: Elegir el valor más reciente en un Select

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
__________________
Mc_Quake

Para ayudar en lo que se pueda:Zzz: