By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,017 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

Call custom function after every sqlConnection.Close()

P: 37
Hi I working on a application which is recording open and close connections time.

Now I want to call my custom function which will write data in to database as soon as connection is closed.

I manually can write function by finding.. sqlConnection.Close() but
Is there any other way by which I would come to know that sqlConnction.Close is called and I an invoke my method.

Thanx in advance.
Jan 2 '09 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 229
Can you handle the StateChange event of your SqlConnection? StateChangeEventArgs will then contain the new ConnectionState.
Jan 2 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.