Click here to Skip to main content
16,019,976 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi Every one.
I have e database in server (SQL SERVER 2005) and a windows application installed in some machines. when i make a particular update in a table i want to notify all users if the application is running on its machine (For example, to show a balloon tool Tip ).
I'm new in programming field and I want to know if it is possible to do that

i don't want to use a timer to check sequentially on db.
thanks.
Posted

Notifications are usually done by polling from the client side, or publishing to clients from the server side.

If you don't want to poll from the client then you will have to to publishing from the server.

Publishing can be done by a UDP packet broadcast on the network.
 
Share this answer
 
You can do this with a trriger and 2 tables.



SQL
CREATE TABLE Event(id INT INDENTITY(0,1), EventTxt VARCHAR(8000))
CREATE TABLE  Viewed (IdUser INT, IdEvent INT, Viewed BIT DEFAULT (0) )
CREATE TRIGGER triger_name
ON   your_table FOR UPDATE AS
 IF
 (
     (UPDATE(your_field))or
 )
 BEGIN
 INSERT INTO Event (EventTxt) VALUES ('Filed was update')
 INSERT INTO
 END


After you do this you will use a watch component to see.
Want new events are in table with this procedure
SQL
PROCEDURE CREATE new_events
@UserId
AS
SELECT e.Id,e.EventTxt FROM 
Event e join Viewed w on e.Id=w.IdEvent WHERE Viewed=0


Now when app show message with event you will
UPDATE Viewed SET Viewed=1 WHERE IdEvent= event id AND IdUser= loged user
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900