Ver Mensaje Individual
  #1  
Antiguo 19-04-2018
javicho_villa javicho_villa is offline
Miembro
 
Registrado: feb 2005
Ubicación: Lima - Perú
Posts: 99
Reputación: 20
javicho_villa Va por buen camino
Smile Excepción: is not a valid date

Buenas tardes,

Quiero agradecer primero por la atención prestada y pedirles me ayuden con este problemita que ya me esta carcomiendo el cerebro hace varios días.

Estoy programando en XE8 con SQL uso componentes ADO y para insertar una tabla llamada Cliente utilizo un AdoStoreProcedure y tengo un campo de tipo fecha llamado FRegistro donde guardo la fecha en que se creo el registro pero me sale el error: Excepción: is not a valid date, ya he probado de todo usando variables de tipo TDate, TDateTime, funciones que devuelven la fecha del sistemas como Date y Now, pero siempre me sale un error que no reconoce el tipo de fecha.

Aquí les copio lo mas resultante del código utilizado:

Código Delphi [-]
        MyClass := TComponent.Create(Self);
         try
           try
             with Datos.DatosDM.PrincipalADOStoredProc do
               begin
                 Close;
                 Parameters.Clear;
                 if ledita=false then
                   begin
                     Parameters.ParseSQL('ClienteInsertar',TRUE);
                     ProcedureName := 'ClienteInsertar';
                   end
....
....
                Parameters.CreateParameter('@TituloDoc3',ftString,pdInput,30,0);          //24
                 if ledita=false then
                   begin
                     Parameters.CreateParameter('@Id_Usuario',ftInteger,pdInput,30,0);         //25
                     Parameters.CreateParameter('@FRegistro',ftDate,pdInput,0,0);              //26
                   end;
.....
....

                 if ledita=false then
                   begin
                     Parameters.ParamByName('@Id_Usuario').Value        := 0;         //25
                     Parameters.ParamByName('@FRegistro').Value         := StrToDate(formatdatetime('YYYY-MM-DD',Date));  
                   end;

                 Parameters.ParamByName('@TituloDetallePedido').Value   := self.TituloDetallePedidoEdit.Text;   //27
                 Parameters.ParamByName('@MiMensaje').Value             := '';//28 PARAMETRO DE SALIDA
                 lacepta := true;
               end;
             Datos.DatosDM.PrincipalADOStoredProc.Prepared := true;
             Datos.DatosDM.PrincipalADOStoredProc.ExecProc;

          finally
             if not VarIsNull(Datos.DatosDM.PrincipalADOStoredProc.Parameters.ParamByName('@MiMensaje').Value) then
                 MiMsjBD := Datos.DatosDM.PrincipalADOStoredProc.Parameters.ParamByName('@MiMensaje').Value;
             MyClass.Free;
           end;
           Except
             ON Error: Exception DO ShowMessage ('Excepción: '+Error.Message);
         end;
       end;


De antemano muchas gracias por leer este post.
__________________
Javier Villa Sánchez
jvilla@andreaproducciones.com
Responder Con Cita