473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Notifying multiple applications of table update

Hello,

I am writing an application using Visual Studio .NET (C#). The
application will be run on several workstations simultaneously, and
all of them will be accessing a single sql server database. I am
trying to have it so that when one of the applications updates the
fields of a table in the database, all of the other applications are
notified (Without polling the DB).

I have been trying to do this by using a SQL Trigger and calling
RaisError from within. This will create an exception for the calling
application (what i wanted), but I can get any of the other
applications to see the error.

Is there a way of accomplishing this using triggers? Is there another
way of notifying all applications of a database change without the use
of polling?

James Chang
ja*********@quest.com.au
Jul 20 '05 #1
1 3956
[posted and mailed, please reply in news]

James Chang (ja*********@quest.com.au) writes:
I am writing an application using Visual Studio .NET (C#). The
application will be run on several workstations simultaneously, and
all of them will be accessing a single sql server database. I am
trying to have it so that when one of the applications updates the
fields of a table in the database, all of the other applications are
notified (Without polling the DB).

I have been trying to do this by using a SQL Trigger and calling
RaisError from within. This will create an exception for the calling
application (what i wanted), but I can get any of the other
applications to see the error.

Is there a way of accomplishing this using triggers? Is there another
way of notifying all applications of a database change without the use
of polling?


You will somehow have to signal to the clients that something has
happened. This is far from a trivial endeavour. You must either write
an extended stored procedure for the task, or write a COM object that
you communicate with the sp_OAmehotds. In either case, you need to
test what your write very carefully, because if you get an execution
error in the code you write, you can bring down the entire SQL Server.

Furthermore, if you actually take the task to signal the other
clients from the XP/COM-object directly, then you will prolong the
execution time for the trigger considerably, and this will have an
impact on concurrency in the system. So, in practice you should
just leave a quick note that does not require acknowledgement, and
then you have an other process which reads these notes, and signals
the processes.

You may also take a look at SQL Server Notification Services, (see
www.microsoft.com/sql) and see if this is something can meet your
needs.

In the end you may find that polling is the simplest, safeest and the
most robust method for you to use.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: RJ | last post by:
We currently send product releases to our customers, and often have to include scripts that need to be ran on the Oracle databases (also do it for SqlServer customers, but we use a different set of...
6
by: Steven An | last post by:
Howdy, I need to write an update query with multiple aggregate functions. Here is an example: UPDATE t SET t.a = ( select avg(f.q) from dbo.foo f where f.p = t.y ), t.b = ( select sum(f.q)...
2
by: news.hp.com | last post by:
I have situation where I need to copy multiple records (only certain fields) from a Rules table to an Events table based on a selection identified in a combo box. When the selection is made in a...
2
by: Craig M | last post by:
Hi, I have a form, frmInvoices and a subform, frmInvoicesSub. On the parent form, i have a "print report" button, that prints a report depending on an ID on the parent form. Each record in...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
0
by: Thom Little | last post by:
I need to have multiple applications in the same 2.0 webspace. I am using the add-in to Visual Studio 2005 that permits me to do this and it creates namespaces in a manner very similar to 1.1 in...
1
by: projectjakecs | last post by:
Hi, I am working on a ms access database and I am having trouble using a form to create new records in an associative table. Here is the breakdown of my database: Main Table - Computer...
0
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td...
5
by: Bill Schanks | last post by:
I have a winform app (VB 2005) that allows users to export data to excel, make updates to the excel file and import the data from that Excel file and update the database. My question is: Is it...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.