Ver Mensaje Individual
  #4  
Antiguo 27-07-2007
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
Si hay un método mejor, utilizar parámetros.
Si utilizaras parámetros no tendrías que hacer eso truquitos para guardar decimales.

Y tambien podrías ahorrarte la variable SQLText.

Ejemplo:

Código Delphi [-]
With AdoQuery1 do begin
 If Active then Close;
 SQL.Clear;
 SQL.Add('INSERT INTO Proyectos (Descripcion, Importe)');
 SQL.Add('VALUES (:Descripcion, :Importe)');
 Parameters.ParamByName('Descripcion').AsString := Edit2.Text;
 Parameters.paramByName('Importe').AsCurrency := CurrencyEdit1.AsCurrency;
 Try
  ExecSQL;
 Except on E:EDBEngineError do begin
   If E.ErrorCode = 902 then  //902 es solo como ejemplo
     showmessgae('error 902'+' en:'+SQL.Text');
  end; //Except
 end; //Try
end; //with
__________________

Responder Con Cita