Ver Mensaje Individual
  #1  
Antiguo 07-03-2008
Avatar de ContraVeneno
ContraVeneno ContraVeneno is offline
Miembro
 
Registrado: may 2005
Ubicación: Torreón, México
Posts: 4.738
Reputación: 23
ContraVeneno Va por buen camino
A mi me parece mejor esto:
Código Delphi [-]
with AQ_Edit do begin
 If active then close;
 SQL.Clear;
 SQL.Add('Insert Into Horario (Hor_Tipo, Per_Nro,Hor_FechaHora)');
 SQL.Add('Values (:Hor_Tipo, :Per_No, :Hor_FechaHora)'); 
 Parameters.ParamByName('Hor_Tipo').Value := DTexto.fieldbyname('Tipo').AsString;
 Parameters.ParamByName('Per_No').Value := DTexto.FieldByName('Ficha').asInteger; //aquí no supe porque lo tomas como cadena, luego lo conviertes a entero,  y luego otra vez a cadena  ??
 Parameters.ParamByName('Hor_FechaHora').Value := StrToDate('06-03-2008 17:25:00');
 //aunque realmente lo que más me gusta hacer sería:
 ParamByName('Hor_FechaHora').AsDateTime := DateTimePicker.DateTime;
 //en lugar de .value, prefiero definir el tipo de dato, pero ADO no me deja 
 //y se empeña en hacerlo solo
 Base.StartTransaction;
 Try 
  ExecSQL
  Base.Commit;
 Except on EDBEngineError do begin
   Base.RollBack;
   raise;
  end; //except
 end; //try
end; //with
__________________


Última edición por ContraVeneno fecha: 07-03-2008 a las 01:07:07.
Responder Con Cita