Lepe te doy las gracias nuevamente por tus rápidas respuesta, seguí tu consejo y agregué al formulario un nuevo ado stored procedure, modifiqué el segundo procedimiento almacenado de la siguiente forma:
Código SQL
[-]
CREATE PROCEDURE spImporteTotalEdadCuentasxPagar
(@Dias integer,
@Importe money OUTPUT,
@Dias1 integer = NULL)
AS
IF (@Dias1 IS Null)
begin
SELECT @Dias1=0
end
IF (@Dias>=90)
BEGIN
SELECT @Importe=IsNull(Sum(Importe),0)
FROM Facturas
WHERE(Aplicada=0) AND DATEDIFF(day,FechaRecepcion, GETDATE())>=@Dias AND DATEDIFF(day,FechaRecepcion, GETDATE())<=@Dias1
END
ELSE
BEGIN
SELECT @Importe=IsNull(Sum(Importe),0)
FROM Facturas
WHERE(Aplicada=0) AND DATEDIFF(day,FechaRecepcion, GETDATE())>=@Dias AND DATEDIFF(day,FechaRecepcion, GETDATE())<=@Dias1
END
GO
y en código del evento click del botón de comando pusé lo siguiente:
Código Delphi
[-]
begin
ADOSPEdadCuentas.Close;
ADOSPEdadCuentas.Parameters.ParamByName('@Edad').Value := StrToInt(EditEdad2.Text);
ADOSPImporteCuentasxPagar.Parameters.ParamByName('@Dias').Value := StrToInt(EditEdad2.Text);
if StrToIntDef(EditEdad2.Text,0) = 90 then
begin
ADOSPEdadCuentas.Parameters.ParamByName('@Edad1').Value := VarNull;
ADOSPImporteCuentasxPagar.Parameters.ParamByName('@Dias1').Value := VarNull;
end
else
ADOSPEdadCuentas.Parameters.ParamByName('@Edad1').Value := StrToInt (EditEdad1.Text);
ADOSPImporteCuentasxPagar.Parameters.ParamByName('@Dias1').Value := StrToInt (EditEdad1.Text);
ADOSPImporteCuentasxPagar.ExecProc;
EditImporte.Text := ADOSPImporteCuentasxPagar.Parameters.ParamValues ['@Importe'];
ADOSPEdadCuentas.Open;
end;
Cuando lo ejecuto, es decir cuando click en el botón de coamando me duveuelve el siguiente mensaje de error, se levanta una excepción en la clase EConvertError with the message is not a valid integer value. He mirado, pero estoy como el pescado en nevera, no encuentro donde está el error. Gracias amigo y disculpa tanta molestia.