How to know database has changed if ADO is disconnected?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I'm deleveloping on ADO .NET with my application. I would like to how to know is database has changed

Regards
KPH
 
There are a bunch of ways depending on how you want to get there. There is
no notification, although you could use SQL Server Notification Services if
you have SQL Server and want to get fancy. The other ways include sending
the data back and checking for a concurrency exception. At some point,
you'll need to make a trip back to the DB to see if anything's changed.
Check out the thread on David Scheppa<sic> book from yesterday or the day
before, there are a few other approaches that will work.
 
Hi KPH,

Thank you for posting in the community! My name is Kevin, and I will be
assisting you on this issue.

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to be notified in your program
when the database changes. If there is any misunderstanding, please feel
free to let me know.

As william mentioned, if you're working on a SQL server as database system,
you can use SQL Server Notification Service to achieve this. You can
download it from the following link, if you already have SQL Server
installed on your machine.

http://www.microsoft.com/sql/ns/downloads/download.asp

Also there are some documentation about the notification service. Please
check the following link:

http://www.microsoft.com/sql/NS/techinfo/productdoc/default.asp

Furthermore, we can take advantage of the concurrency error to achieve
this. When updating the database, if there is an concurrency error, the row
containing the error will not be updated. So we can handle the RowUpdated
event to check the RecordsAffected property. If no records are affected, it
mean the row is changed since the record was selected. Here's an article
with a sample code to test the optimistic concurrency.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconOptimisticConcurrency.asp

Does this answer your question? If anything is unclear, please feel free to
reply to the post. I am standing by to be of assistance.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Kevin

Thank you for your reply

Can I use the Notification Service with MSDE server

Thanks
KPH
 
Hi KPH,

Based on the readme of Notification Service, SQL Server 2000 Desktop Engine
(MSDE 2000), SQL Server 2000 Personal Edition, and SQL Server 2000 CE
Edition are NOT supported by Notification Services. You can also check the
Notification Service documentation for more information.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top