﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » Updates and Information » Samples and Solutions  » QueryNotification Services Sample</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 25 May 2026 10:02:26 GMT</lastBuildDate><ttl>20</ttl><item><title>QueryNotification Services Sample</title><link>http://forum.strataframe.net/FindPost16012.aspx</link><description>This sample shows how to receive query notifications using notification services in SQL Server 2005.&amp;nbsp; To do this, the following things are required:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;SQL Server 2005&lt;/LI&gt;&lt;LI&gt;Notification services must be installed.&amp;nbsp; You will see this as a folder within SQL Server Management Studio (Notification Services)&lt;/LI&gt;&lt;LI&gt;Broker Service must be enabled for the database.&amp;nbsp; If you are using the DDT, just check this in the Database properties.&amp;nbsp; Otherwise, you can enable this like this:&lt;BR&gt;&lt;BR&gt;ALTER DATABASE StrataFrameSample SET ENABLE_BROKER&lt;BR&gt;&lt;BR&gt;In this example, you will need to manually execute the above command to turn on the broker service for the StrataFrameSample database (not by default).&lt;/LI&gt;&lt;LI&gt;Set the ReceiveQueryNotificationServices property to True on the BO&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Next, you will want to handle the ServerDataChanged event.&amp;nbsp; This will be raised if there is an error qith the notification or if the query has changed.&amp;nbsp; If there was an error with the subscription, the Info property will indicate Invalid (in most cases).&amp;nbsp; If the ServerDataChanged event is not raised immediately after query is called, then it is subscribed.&amp;nbsp; You can determine this for sure by looking at the queues in SQL Server Management Studio.&lt;/P&gt;&lt;P&gt;Also, when creating queries, wildcards will not work and the schema names must be included in the queries.&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Won't Work&lt;BR&gt;&lt;BR&gt;&lt;/STRONG&gt;SELECT * FROM Customers&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;Will Work&lt;BR&gt;&lt;BR&gt;&lt;/STRONG&gt;SELECT cust_LastName FROM dbo.Customers&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How To Use This Sample&lt;BR&gt;&lt;/STRONG&gt;&lt;BR&gt;Simply run two instances of this sample once compiled.&amp;nbsp; Change the value of the last or first name on one of the forms.&amp;nbsp; You will then see a message box appear with the notification values and then refresh the dialog with the changes.</description><pubDate>Tue, 29 Apr 2008 22:27:47 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>