I've TMSServiceBroker in my form. It works fine.
But, I get an error message when I want to make disabled TMSChageNotification in Destroy.
My code is bellow.
Code: Select all
sbBroker: TMSServiceBroker;
cfNotifyMessage: TMSChangeNotification;
qNotifyCount: TMMSQuery;
procedure TForm1.CreateBroker;
begin
qNotifyCount.Close;
cfNotifyMessage.Enabled := False;
sbBroker.Service := GetUniqueServiceName;
sbBroker.CreateServerObjects('http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification');
cfNotifyMessage.Service := sbBroker.Service;
cfNotifyMessage.Enabled := True;
qNotifyCount.Open;
end;
destructor TForm1.Destroy;
begin
qNotifyCount.Close;
if sbBroker.Service <> '' then cfNotifyMessage.Enabled := False;
cnBase.Disconnect;
inherited;
end;
---------------------------
Debugger Exception Notification
---------------------------
Project PROJECT.exe raised exception class EOLEDBError with message 'Operation canceled'.
---------------------------