To reproduce the problem, create this stored procedure:
Code: Select all
create proc dbo.sp_test @test numeric(12,2)
as
Begin
set @test = @test
End
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
Connection: TSQLConnection;
Dataset: TSQLDataset;
begin
Connection := TSQLConnection.Create(self);
try
with Connection do begin
LoginPrompt := False;
DriverName := 'SQLServer';
GetDriverFunc := 'getSQLDriverSQLServer';
LibraryName := 'dbexpsda.dll';
VendorLib := 'sqloledb.DLL';
Params.Values['Database'] := MyServer + '/' + MyDatabase;
Params.Values['User_Name'] := MyUserName;
Params.Values['Password'] := MyPassword;
Connected := True;
SQLConnection.SetOption(TSQLConnectionOption(102), Integer(False));
end;
Dataset := TSQLDataset.Create(self);
try
with Dataset do begin
SQLConnection := Connection;
CommandType := ctStoredProc;
CommandText := 'sp_test';
ParamByName('test').AsFloat := 0;
ExecSQL; // <-- BCD Overflow!
end;
finally
Dataset.Free;
end;
finally
Connection.Free;
end;
end;