Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > MS SQL Server
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 05-02-2010
Avatar de richy08
richy08 richy08 is offline
Miembro
 
Registrado: may 2007
Ubicación: Bucerias, Nayarit Mexico
Posts: 529
Poder: 20
richy08 Va por buen camino
efectivamente los campos donde recupero y guardo son datetime este es el procedimiento almacenado
Código SQL [-]
et ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER procedure [dbo].[Frm_ProRellExcRatFillExcRat] (@Dtp_ArrDat datetime, @Dtp_deda datetime, @excrat float)
as 
declare 
 @nconf int, @darrivaldate datetime, @ddeparturedate datetime, @nrenpost int, @nrenpost1 int, @fechaAum datetime
begin
    Declare Qry_Busnconf Cursor For
    select nconf, darrivaldate, ddeparturedate from reserve 
    where @Dtp_ArrDat between darrivaldate and ddeparturedate
    open Qry_Busnconf
    FETCH NEXT from Qry_Busnconf into @nconf, @darrivaldate, @ddeparturedate
    while @@fetch_status = 0
    begin
         Declare Qry_Busnrenpost Cursor For
         select nrenpost from posteosgue p, renposteosguecon r 
         where p.npost=r.npost and nconf=@nconf
         and nexcrat is null and dfech=@Dtp_ArrDat

         open Qry_Busnrenpost
            
         FETCH NEXT from Qry_Busnrenpost into @nrenpost

         while @@fetch_status = 0
         begin
            --Qry_ModiExcrat
            update renposteosguecon set nexcrat=@excrat
            where nrenpost=@nrenpost
            --Qry_ModiExcrat

         FETCH NEXT from Qry_Busnrenpost into @nrenpost
         end
         close Qry_Busnrenpost
         deallocate Qry_Busnrenpost
      
             set @fechaAum= (DATEADD(day, 2, @Dtp_ArrDat))
             print @fechaAum
             print @ddeparturedate 
             print '**************'
         if  @fechaAum=@ddeparturedate 
         begin
              print 'adentro'
              print @ddeparturedate
             --print '**************'
             Declare Qry_Busnrenpost1 Cursor For
             select nrenpost from posteosgue p, renposteosguecon r 
             where p.npost=r.npost and nconf=@nconf
             and nexcrat is null and dfech=@ddeparturedate

             open Qry_Busnrenpost1
            
             FETCH NEXT from Qry_Busnrenpost1 into @nrenpost1
             print @nrenpost1
             
             while @@fetch_status = 0
             begin
                print @nrenpost1
                --Qry_ModiExcrat
                update renposteosguecon set nexcrat=@excrat
                where nrenpost=@nrenpost1
                --Qry_ModiExcrat

             FETCH NEXT from Qry_Busnrenpost1 into @nrenpost1
             end
             close Qry_Busnrenpost1
             deallocate Qry_Busnrenpost1
         end;     
    FETCH NEXT from Qry_Busnconf into @nconf, @darrivaldate, @ddeparturedate
    end
    close Qry_Busnconf
    deallocate Qry_Busnconf
end

y lo mando llamar desde delphi con un stored procedured de ado de esta forma

Código Delphi [-]
SP_FillExcrat.Close;
SP_FillExcrat.Prepared:=true;
SP_FillExcrat.Parameters[1].Value:=FormatDateTime('yyyy,mm,dd',Dtp_ArrDat.date);
SP_FillExcrat.Parameters[2].Value:=FormatDateTime('yyyy,mm,dd',Dtp_DeDa.date);
SP_FillExcrat.Parameters[3].Value:=Md_Gral.Qry_KindChan.fieldbyname('Kind').Value;
SP_FillExcrat.ExecProc;

lo extraño es que las primeras insercciones si las hace de manera correcta pero al llegar al if

Código SQL [-]
             set @fechaAum= (DATEADD(day, 2, @Dtp_ArrDat))
             print @fechaAum
             print @ddeparturedate 
             print '**************'
             if  @fechaAum=@ddeparturedate 
             begin

si entra pero el cursor no encuentra ningun registro aunque yo los estoy viendo en la base de datos alguna idea de cual pueda ser la razon gracias por tu tiempo
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Problemas Retorno de Valor SP MSSQL subzero PHP 1 08-04-2009 23:56:17
Problemas con Zeos y MSSQL 2000 indiralanza Conexión con bases de datos 3 21-07-2007 16:27:36
Delphi for PHP y MSSQL: problemas david.rguez PHP 3 23-04-2007 23:05:30
tabla como retorno de procedimiento MSSQL 2000 luisgutierrezb SQL 1 24-08-2006 18:53:28
Problemas con parametro Null en MSSQL Server 2000 pigu SQL 1 27-10-2005 22:18:44


La franja horaria es GMT +2. Ahora son las 05:39:02.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi