Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Can you remotely start a process in Visual Basic?

Basically, I have two applications. One resides on the server, where it maintains a database, and one on client machines connected to the server. When one client updates the database, the information needs to be updated on all of the clients' machines. The server application is informed when the database changes, but the method (SqlDependency) would put too much strain on the system if it were pushing to all of the machines (potentially hundreds as the application is rolled out, and the server can't deal with that many and maintain speed).

My question is, if the server application is informed of a change, can it fire a command in the client application on the machines? When that happens, they'd respond as necessary, and pull the changed data from the database. Polling isn't really an option, as it'd put a lot of strain on the machines and the server, and slow response times causing potential data integrity issues.

Thanks in advance.

Update:

Wanderer: Thanks! I've got a table in the database for a "master log" that records information on the time a change occurred, who made it, and some security information, so that'll be the one I'm watching. Your solution got me thinking about something I'd not even connected as a possibility: FileSystemWatcher. Unless I'm very much mistaken, each client can use that to listen for changes to the database file (last write time) and then I'd be able to skip out the "middle-man" server application entirely (for this purpose, anyway).

1 Answer

Relevance
  • ?
    Lv 6
    8 years ago
    Favorite Answer

    Yeah this is an interesting problem, what you need to do is implement a listening service... the way that works is that on start-up, each client application connects to the server (for instance though a web service running on the server) and starts to 'listen' for an event (e.g. a data change notification)... when the event occurs, the web service informs all the listening (waiting) clients that the data has changed, then each client can update...

    You would still use the SqlDependency BUT it would only have to inform the single web service (not ALL the clients) that something has changed in the data....

    Essential what you are looking for is similar to a chat program... the web service manages the communication and distribution of messages between each client and itself... it in turn responds to the data change notification broadcast from SQL server…. here is an example that shows how it would work

    http://www.codeproject.com/Articles/25615/Duplex-W...

    incidentally, in my experience, the SqlDependency should only be attached to a single table in your database, if you attach this command to multiple tables then you get notifications from SQL for each table and that can get pretty busy if you have a lot of clients updating data… so for example if you update records in two tables then you will get two notifications (if you are watching both tables)… what I did was to have a single master table, updating the data would also add a record to the master table which would then trigger and broadcast the notification event to the WCF Service, the webservice would then broadcast the change to each client, once the web service was happy that all the [attached/listening] clients had got the message it then deleted the original record from the a single master table and the process starts again…

Still have questions? Get your answers by asking now.