Question

I will do a project using "sql server service broker". I have never used it but tried tutorials from microsoft website and I think I got the idea. Now, I can create all the required elements for service broker in the database. but my question is, how do you use service broker from c#. I want to add messages to queue from c# and read from c#?

I read that I can access the queue table with old style sql like below

select columns from SchemaName.QueueName WITH(NOLOCK);

but I dont think this is the correct way. how can I do it properly in c#? please give me a clue

Was it helpful?

Solution

According to BOL, only Service Broker can add to the queue:

Service Broker manages updates to queues. Although the name of a queue can be used in place of a table name in a SELECT statement, a queue cannot be the target of an INSERT, UPDATE, DELETE, or TRUNCATE statement.

You can run normal queries on the queue using ADO .Net

Take a look here: http://msdn.microsoft.com/en-us/library/ms166127%28v=sql.100%29.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top