PC Review


Reply
Thread Tools Rate Thread

Detecting changes in a database

 
 
Dom
Guest
Posts: n/a
 
      17th Apr 2009
I have a program used by many people. Each person makes changes in a
database. I would like to have all the users see these changes soon
after they are made.

Is there some way to do this in CSharp?

Ideally, I would like something like:


SetWatchPoint (Database, Table, CallbackRoutine)

CallbackRoutine ()
{
[Code to handle the changes]
[For example, add new records to a listbox]
}

Thanks a lot,
Dom
 
Reply With Quote
 
 
 
 
joecool1969@live.com
Guest
Posts: n/a
 
      17th Apr 2009
On Apr 17, 10:27*am, Dom <dolivas...@gmail.com> wrote:
> I have a program used by many people. *Each person makes changes in a
> database. *I would like to have all the users see these changes soon
> after they are made.
>
> Is there some way to do this in CSharp?
>
> Ideally, I would like something like:
>
> SetWatchPoint (Database, Table, CallbackRoutine)
>
> CallbackRoutine ()
> {
> * *[Code to handle the changes]
> * *[For example, add new records to a listbox]
>
> }
>


Not sure if this is the answer, but you might try looking into the
SqlDependency class.
 
Reply With Quote
 
Dom
Guest
Posts: n/a
 
      17th Apr 2009
On Apr 17, 11:09*am, joecool1...@live.com wrote:
> On Apr 17, 10:27*am, Dom <dolivas...@gmail.com> wrote:
>
>
>
>
>
> > I have a program used by many people. *Each person makes changes in a
> > database. *I would like to have all the users see these changes soon
> > after they are made.

>
> > Is there some way to do this in CSharp?

>
> > Ideally, I would like something like:

>
> > SetWatchPoint (Database, Table, CallbackRoutine)

>
> > CallbackRoutine ()
> > {
> > * *[Code to handle the changes]
> > * *[For example, add new records to a listbox]

>
> > }

>
> Not sure if this is the answer, but you might try looking into the
> SqlDependency class.- Hide quoted text -
>
> - Show quoted text -


Thanks. It certainly looks right. have you ever used it? If so can
you give me a mockup of some code?

Dom
 
Reply With Quote
 
joecool1969@live.com
Guest
Posts: n/a
 
      17th Apr 2009
On Apr 17, 11:16*am, Dom <dolivas...@gmail.com> wrote:
> On Apr 17, 11:09*am, joecool1...@live.com wrote:
>
>
>
>
>
> > On Apr 17, 10:27*am, Dom <dolivas...@gmail.com> wrote:

>
> > > I have a program used by many people. *Each person makes changes ina
> > > database. *I would like to have all the users see these changes soon
> > > after they are made.

>
> > > Is there some way to do this in CSharp?

>
> > > Ideally, I would like something like:

>
> > > SetWatchPoint (Database, Table, CallbackRoutine)

>
> > > CallbackRoutine ()
> > > {
> > > * *[Code to handle the changes]
> > > * *[For example, add new records to a listbox]

>
> > > }

>
> > Not sure if this is the answer, but you might try looking into the
> > SqlDependency class.- Hide quoted text -

>
> > - Show quoted text -

>
> Thanks. *It certainly looks right. *have you ever used it? *If so can
> you give me a mockup of some code?
>


Sorry, I just thought I'd check the online help and founf that after a
search on "SqlClient Namespace". Never really used it myself.

I would probaly go the simpler route and use a log table that contains
a time stamp of the latest change and check the latest entry in a
timer loop.
 
Reply With Quote
 
Simon Hart [MVP]
Guest
Posts: n/a
 
      18th Apr 2009
You could easily do this using nHibernate too. Implement the IInterceptor
interface then you can catch pre-write post write etc operations.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://www.simonrhart.com


"Dom" wrote:

> I have a program used by many people. Each person makes changes in a
> database. I would like to have all the users see these changes soon
> after they are made.
>
> Is there some way to do this in CSharp?
>
> Ideally, I would like something like:
>
>
> SetWatchPoint (Database, Table, CallbackRoutine)
>
> CallbackRoutine ()
> {
> [Code to handle the changes]
> [For example, add new records to a listbox]
> }
>
> Thanks a lot,
> Dom
>

 
Reply With Quote
 
Dom
Guest
Posts: n/a
 
      18th Apr 2009
On Apr 18, 7:18*am, Simon Hart [MVP] <srhart...@yahoo.com> wrote:
> You could easily do this using nHibernate too. Implement the IInterceptor
> interface then you can catch pre-write post write etc operations.
> --
> Simon Hart
> Visual Developer - Device Application Development MVPhttp://www.simonrhart.com
>
>
>
> "Dom" wrote:
> > I have a program used by many people. *Each person makes changes in a
> > database. *I would like to have all the users see these changes soon
> > after they are made.

>
> > Is there some way to do this in CSharp?

>
> > Ideally, I would like something like:

>
> > SetWatchPoint (Database, Table, CallbackRoutine)

>
> > CallbackRoutine ()
> > {
> > * *[Code to handle the changes]
> > * *[For example, add new records to a listbox]
> > }

>
> > Thanks a lot,
> > Dom- Hide quoted text -

>
> - Show quoted text -


Thanks for the tip. I know nothing about Hibernate. Can you point me
to some classes, or an article? If not, Jowcoll1 had the best
suggestion.

Dom
 
Reply With Quote
 
Simon Hart [MVP]
Guest
Posts: n/a
 
      18th Apr 2009
nHibernate is an ORM. I don't know you're requirements. nHibernate aould
replace pretty much your whole data acess layer if used. Checkout
hibernate.org.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://www.simonrhart.com


"Dom" wrote:

> On Apr 18, 7:18 am, Simon Hart [MVP] <srhart...@yahoo.com> wrote:
> > You could easily do this using nHibernate too. Implement the IInterceptor
> > interface then you can catch pre-write post write etc operations.
> > --
> > Simon Hart
> > Visual Developer - Device Application Development MVPhttp://www.simonrhart.com
> >
> >
> >
> > "Dom" wrote:
> > > I have a program used by many people. Each person makes changes in a
> > > database. I would like to have all the users see these changes soon
> > > after they are made.

> >
> > > Is there some way to do this in CSharp?

> >
> > > Ideally, I would like something like:

> >
> > > SetWatchPoint (Database, Table, CallbackRoutine)

> >
> > > CallbackRoutine ()
> > > {
> > > [Code to handle the changes]
> > > [For example, add new records to a listbox]
> > > }

> >
> > > Thanks a lot,
> > > Dom- Hide quoted text -

> >
> > - Show quoted text -

>
> Thanks for the tip. I know nothing about Hibernate. Can you point me
> to some classes, or an article? If not, Jowcoll1 had the best
> suggestion.
>
> Dom
>

 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      19th Apr 2009
Simon Hart [MVP] wrote:
> You could easily do this using nHibernate too. Implement the IInterceptor
> interface then you can catch pre-write post write etc operations.


But that is for changes made via NHibernate within the same
process or ??

Arne
 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      21st Apr 2009
Notifications is the way to go if you are using any recentish SQL Server
product.

This is ish how the old version worked.

Add a triger to your table that updates a table specifically created to hold
a datetimestamp for that table, on insert, update and delete.

Poll this table (background task) for the datetime stamp of the table you
want to identify if changes have been made to. Of course this is not very
granular.

Add a datetimestamp to each row to catch updates on a more granular level.
To catch deletes on a more granular level you need to implement a
datearchived type flag rather than deleting records.






"Dom" <(E-Mail Removed)> wrote in message
news:df4c0a26-a70a-4496-89f5-(E-Mail Removed)...
>I have a program used by many people. Each person makes changes in a
> database. I would like to have all the users see these changes soon
> after they are made.
>
> Is there some way to do this in CSharp?
>
> Ideally, I would like something like:
>
>
> SetWatchPoint (Database, Table, CallbackRoutine)
>
> CallbackRoutine ()
> {
> [Code to handle the changes]
> [For example, add new records to a listbox]
> }
>
> Thanks a lot,
> Dom



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting changes in a DataGridView and saving them to the database Andrew Microsoft VB .NET 1 24th Apr 2009 11:44 AM
Detecting database name iris_adyla Microsoft Access Macros 0 30th Jan 2008 04:18 AM
Detecting Changes in Database Table from app Dave.Womer@gmail.com Microsoft ADO .NET 1 10th Aug 2007 02:04 PM
Detecting database Size =?Utf-8?B?Um9zcw==?= Microsoft Access VBA Modules 3 27th Feb 2006 03:40 PM
Detecting when user closes application or database John C. Microsoft Access VBA Modules 1 6th Dec 2003 10:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:42 AM.