Ver Mensaje Individual
  #1  
Antiguo 27-05-2010
Avatar de MAXIUM
MAXIUM MAXIUM is offline
Miembro
 
Registrado: may 2005
Posts: 1.503
Reputación: 23
MAXIUM Va camino a la fama
Insert con una variable entera

Estoy usando el componente IBSQL y quiero hacer un insert usando una variable de tipo entero, pero me arroja error.

Código Delphi [-]
Var
    Total: Integer;
Begin

Total:= 435;

with Consulta do
  begin
    SQL.Clear;
    SQL.Add( 'INSERT INTO CLIENTES' );
    SQL.Add( '( NOMBRE, NIF, IMPORTEPTE )' );
    SQL.Add( 'VALUES' );
    SQL.Add( '( ''ANTONIO GARCIA LOPEZ'', ''46876283D'', Total )' );

    Transaction.StartTransaction;

    try
      ExecQuery;
      Transaction.Commit;
    except
      on E: Exception do
      begin
        Application.MessageBox( PChar( E.Message ), 'Error de SQL', MB_ICONSTOP );
        Transaccion.Rollback;
      end;
    end;
  end;
End;
Responder Con Cita