September 7, 2005 at 11:52 am
I'm writing a VB program that connects to SQL Server and I want to be able to notify the user when their connection is killed. Is there an event that is triggered when an ADODB connection is killed? If not, is there a way to write one?
September 7, 2005 at 12:12 pm
You can net send on the network and warn everyone that the server is shutting down.
September 7, 2005 at 12:18 pm
Actually, we currently use netsend to warn everyone, but the problem is that we're only going to be killing specific process IDs.
What we're doing is that we're setting up our server to be remote desktopped, but only one person can access it at a time and if someone else tries to access it, they boot the person on it without being notified. So what we plan on doing is writing a VB app that will sit in the taskbar as an icon and notify people when it's being accessed and when it's free. Does this make sense?
September 7, 2005 at 12:23 pm
Err, why can there be only one person at the time using the system?
September 7, 2005 at 12:26 pm
We all use the same username and password to access our development server.
September 7, 2005 at 12:27 pm
Can't you create more??
September 7, 2005 at 12:30 pm
*grins* I'm just a programmer trainee researching this problem. I don't really have a say in these things. I was just told to find out if there was a way we can notify everyone when the server is being used and when it is free again.
September 7, 2005 at 12:37 pm
I'm sure there's a way, but sql server is mean to give access to multiple users at the same time... I don't see why you'd what to limit this to only one (except for load testing maybe).
September 7, 2005 at 12:47 pm
Ohhhhh... it appears I didn't make myself clear. I'm sorry! It's not SQL Server that we're limiting to one user. We're limiting the use of our development server (to compile code and make changes and such) to one user at a time. We're storing the data of who's accessing the server in our SQL Server database. The program we're writing will access this data, but one of the conditions is that we don't want the program to constantly be grabbing data from SQL Server to determine whether or not someone is already using the server. That would be a lot of unnecessary traffic. It would be easy to do it that way, but not feasible. Instead we want it to notify only on connect/disconnect and not constantly be polling the data. I'm sorry again that I wasn't very clear. I hope that cleared it up a bit.
September 7, 2005 at 1:11 pm
I think that you'd have to limit the windows remote access somehow. Other than that I can't offer much help on this topic.
September 7, 2005 at 1:21 pm
Thanks for replying anyway! If I can't figure out a way to solve this, I'm going to suggest that.
September 8, 2005 at 8:49 am
We're missing the point here folks. Whatever the original poster's design motives (good or bad), she's asking how to watch for events with an ADO connection, which is a valid question.
Just Declare your Connection like this at the top of a form module:
Dim WithEvents conNewConnection as Adodb.Connection
Then you'll have events available like ExecuteComplete, Disconnect, ConnectComplete and a few others. Obviously, you have to write code to do the notifying and so forth, but once these events are exposed you can do that.
Student of SQL and Golf, Master of Neither
September 8, 2005 at 9:16 am
Thank you! I did manage to get that working. However, the disconnect doesn't fire when SQL Server kills the process... only when the VB app does. I think I'm going to have to approach this problem in a totally different way, but that code *is* what I was looking for originally.
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply