SQL Notification Services
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



SQL Notification ServicesExpand / Collapse
Author
Message
Posted 04/29/2008 4:52:33 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 7:04:50 PM
Posts: 61, Visits: 147
I haven't used SQL Notification Services before so this is all new to me.

I have notification services installed, the broker service is enabled on the database and I have set the BO ReceiveQueryNotifications to True. When I run a form containing the BO I get the error:-

"When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance"

I have done nothing in SQL Notification Services itself as I have assumed SF handles this for me. Are there any additional steps I have missed in Notification Services itself?

Thanks in advance,

Aaron

Post #16006
Posted 04/29/2008 10:30:28 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 3:24:00 PM
Posts: 3,733, Visits: 3,926
Two things...first, there was a bug on how the connection string was being registered.  Also, I created a sample that shows how to use this type of service.  Use the attached assembly to replace your Base that will resolve the error.  This will be in the next build that I post (I am assuming that you are on the 1.6.6 beta).  This should get you going.

Here is the sample: http://forum.strataframe.net/FindPost16012.aspx

  Post Attachments 
MicroFourStrataFrameBase.zip (5 views, 490.61 KB)

Post #16013
Posted 04/30/2008 6:43:35 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 7:04:50 PM
Posts: 61, Visits: 147
I have installed the latest beta and updated the base DLL but I am afraid I still get the error.

Have I done something wrong?

Thanks

Post #16059
Posted 04/30/2008 7:16:08 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 3:24:00 PM
Posts: 3,733, Visits: 3,926
Did you run the sample and look at some of my notes?

Have I done something wrong?

This is a tough question to answer   There are a lot of "gotchas" when using Query Notifications.  You have to have properly formatted queries with explicit field names, schema names provided for tables, etc.

Last night when I was messing with the sample I chased my tail for a while because I left the dbo off of the Customers table in the query.  There are quite a few rules when using the SqlDependency...but I did get it working and that is why I provided the sample and some of my notes to get it to work as SQL Server is very strict when subscribing to a notification.

Post #16060
Posted 05/01/2008 5:35:19 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 7:04:50 PM
Posts: 61, Visits: 147
Ah, I don't think I have the dbo in my query either. I am using

"SELECT " + AllFieldNames + " FROM " + TableName

and I think the latter doesn't have the dbo. I will change this and try again.

Post #16063
Posted 05/01/2008 8:33:40 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 3:24:00 PM
Posts: 3,733, Visits: 3,926
Sounds good.
Post #16064
Posted 05/01/2008 6:12:05 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: 2 days ago @ 7:04:50 PM
Posts: 61, Visits: 147
I have tried "SELECT " + AllFieldNames + " FROM " + TableNameAndSchema and I get the same error. I have looked at your sample and I think I am doing the same.

Did you have to setup or initialise SQL Notification Services itself other than the ALTER DATABASE xxxxx SET ENABLE_BROKER? My SQL Notification Services was simply installed out of the box with no post configuration beyond the intial setup.

I will be away for a couple of days so thanks in advance.

Aaron

Post #16079
Posted 05/01/2008 7:12:07 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 3:24:00 PM
Posts: 3,733, Visits: 3,926
The user to which is trying to subscribe has to have those permissions as well.  StrataFrame does everything that has to be done on the .NET side in regards to setting up the SqlDependency and then notifying you of the changes.  However, the part that you are having the issue with is more than likely the SQL side...and getting it setup.  This is one reason that we elect not to use Query notifications in the field as you can fight this issue often...so we generally take another aproach. 

But back to the point of the matter, to grant a subscription permission to a user you would do this:

GRANT SUBSCRIBE QUERY NOTIFICATIONS TO [sqldependency_user]

Post #16081
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse