reddal
asked on
How to receive a notification of a data change in c# from SQL Server 2005?
Hi,
I have a .NET (v1.1) c# console application that accesses data in an SQL Server 2005 database, via SQL.
I want to have a mechanism to receive a notification (event? trigger?) when something changes in a given table so I can reload it. Whats the easiest way to code that? Obviously I could just poll or something like that - but I'm sure there will be a nice solution supported by my combination of .NET 1.1 SQLConnection classes and SQL Server 2005 backend.
Whats the best/easiest way to achieve that?
thanks - reddal
I have a .NET (v1.1) c# console application that accesses data in an SQL Server 2005 database, via SQL.
I want to have a mechanism to receive a notification (event? trigger?) when something changes in a given table so I can reload it. Whats the easiest way to code that? Obviously I could just poll or something like that - but I'm sure there will be a nice solution supported by my combination of .NET 1.1 SQLConnection classes and SQL Server 2005 backend.
Whats the best/easiest way to achieve that?
thanks - reddal
Create a second table with the following columns
Tablename (varchar) , lastupdated (datetime), complete (bit)
You could create a SQL update trigger
on the table you want to monitor to insert
a record into the "monitor table" with the name of the table, the date/time of the update and set the complete field to 0
You'd then be able to query that monitoring table for "action required"
Tablename (varchar) , lastupdated (datetime), complete (bit)
You could create a SQL update trigger
on the table you want to monitor to insert
a record into the "monitor table" with the name of the table, the date/time of the update and set the complete field to 0
You'd then be able to query that monitoring table for "action required"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
> emoreau: can you migrate to .Net 2.0?
Yes that is planned (to 3.5 in fact) - but not immediately. Do you know if there is a .NET 1.1 solution?
> Auric1983:
I would still have to poll the monitoring table at regular intervals using your solution I think? I'm hoping to find a way to avoid that.
- reddal
Yes that is planned (to 3.5 in fact) - but not immediately. Do you know if there is a .NET 1.1 solution?
> Auric1983:
I would still have to poll the monitoring table at regular intervals using your solution I think? I'm hoping to find a way to avoid that.
- reddal
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks - you saved me a lot of wasted time trying to find a solution that doesn't exist.
can you migrate to .Net 2.0?