Ver Mensaje Individual
  #4  
Antiguo 29-11-2006
Avatar de Bender
Bender Bender is offline
Registrado
 
Registrado: nov 2005
Ubicación: Orihuela
Posts: 3
Reputación: 0
Bender Va por buen camino
Si estas usando SQL Server yo uso una funcion para convertir las fechas
Código Delphi [-]
function MSSQLFormatDate(ADate : TDateTime) : String ;
var
  dd,mm,yy : Word ;
  hh,mn,ss,ms : Word ;
  str : String ;

  dia, mes , ano : String ;
  hora, minuto, segundo, milisegundo : String ;
const
  Comilla = '''' ;
begin

  DecodeDateTime(ADate,yy,mm,dd,hh,mn,ss,ms);

  dia := inttostr(dd);
  mes := inttostr(mm);
  ano := inttostr(yy);
  hora := inttostr(hh);
  minuto := inttostr(mn);
  segundo := inttostr(ss);
  milisegundo := IntToStr(ms) ;

  str := '' +
  ' CONVERT(DATETIME, ' +
  Comilla + dia + '-' + mes + '-' + ano +
  ' ' + hora + ':' + minuto + ':' + segundo + ':' + milisegundo + Comilla +
  ',103)' ;


  Result := str ;

end;

Código Delphi [-]
query2.SQL.Clear;
query2.SQL.Add('insert into e_pedido (Cve_Pd,Cve_Pr,Fecha_P)VALUES('+
quotedstr(MaskEdit3.Text)+','+
quotedstr(MaskEdit1.Text)+','+
MSSQLFormatDate(DateTimePicker1.date)+')');
ShowMessage(Query2.Sql.Text);
query2.ExecSQL;
Responder Con Cita