﻿<?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 / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>forum@strataframe.net</webMaster><lastBuildDate>Fri, 04 Jul 2008 22:57:00 GMT</lastBuildDate><ttl>20</ttl><item><title>QueryNotification Services Sample</title><link>http://forum.strataframe.net/Topic16012-17-1.aspx</link><description>This sample shows how to receive query notifications using notification services in SQL Server 2005.  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.  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.  If you are using the DDT, just check this in the Database properties.  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.  This will be raised if there is an error qith the notification or if the query has changed.  If there was an error with the subscription, the Info property will indicate Invalid (in most cases).  If the ServerDataChanged event is not raised immediately after query is called, then it is subscribed.  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.  Change the value of the last or first name on one of the forms.  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>