Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: walex en 25 Octubre 2005, 17:23 pm



Título: codigo para obtener los años cumplidos en VF 6.0
Publicado por: walex en 25 Octubre 2005, 17:23 pm
fecha= date()
update coosalud set fechactual=fecha  where numcon= '25'

select count(*) as contar, fechanac as fn,fechactual as fa from coosalud where numdoc= '1070587053' into cursor Matriz
res=(year(fa) - year(fn))
dat= str((month(fa))+ (12 - month(fn)),2,2)
mes= month(fa)+ (12 - month(fn))
año= str(res,2,2)
año1= (res - 1)
rpt= str(año1,2,2)

if res > 1 then
      if month(fn) > month(fa) then
         año= (res - 1)
         update coosalud set edad=rpt, unidad='1'  where coddep= '15'
      else
           update coosalud set edad=año, unidad='1'  where coddep= '15'
      endif
   else
      if month(fa) < month(fn) then
         update coosalud set edad=dat, unidad='2' where coddep= '15'
       Else
          rta= val(str(month(fa)- month(fn)))
         update coosalud set edad=mes, unidad='2' where coddep='15'
       Endif
   EndIF

.... por favor si lo mejoras... publica las mejoras como
teniendo en cuenta tambien los dìas esta hecho todavia