Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > SQLConnection event catch, please help

Reply
Thread Tools

SQLConnection event catch, please help

 
 
Amar
Guest
Posts: n/a
 
      06-10-2004
I have an SQLConnection object that is being used through all my
webpages of my site. I have a base Web Page that has this Connection,
and all my pages inherit from that one. Is there any way, any event
that i can catch BEFORE any sqlstatement that is being executed with
this connection to handle the statement? I don't want to do it at
every page that i have, i want to make changes at the parent
SQLConnection and that do all the check for me.
 
Reply With Quote
 
 
 
 
Trevor Benedict R
Guest
Posts: n/a
 
      06-10-2004
There is no readymade event that can help you with this, but you can
hide the internal connection and expose that connection through another
class that can handle the event, like if you have an Execute Method on
the connection, you class should also have this and then validate and
then call the Execute method the the connection.

Hope I understood your question in the first place.

Regards,

Trevor Benedict R


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Amar
Guest
Posts: n/a
 
      06-10-2004
The problem is that i don't use any Execute Method, i use it in many
different ways e.g.

SqlCommand sCmd = new SqlCommand();
sCmd.Connection = FormConnection ;
sCmd.CommandText = "Select whatever....."

or i use with SqlDataRepeater , or to fill a Dataset..... and so on..

i have tried to use the StateChangeEventHandler of the connection but
the .NET MSDB supports for now only Open and Closed states, there are
some other states like Executing but MSDN declare that (This value is
reserved for future versions of the product.)!!!!!!!!!!!

In other words i want to know every object that uses my connection,
SqlDataDapter or SqlCommand or whatever. I am not sure that this can
be done, maybe it is impossible, but i want to avoid to check any
sqlstatement for every page my project has!!

Thanks again, i hope you understand my english.
 
Reply With Quote
 
Trevor Benedict R
Guest
Posts: n/a
 
      06-11-2004
You are trying to use the Underlying Object & trap the Event at the same
time which is not supported. Hence you have to hide the connection
object inside a class of your own while giving wrapper functions that
would Execute on the Underlying connection and here you will have the
ability to extend each method of property call as required.

Regards,

Trevor Benedict R

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Help -- SQLConnection Problem Michael D Murphy ASP .Net 19 09-05-2005 11:57 PM
Can't open a SqlConnection Mark ASP .Net 3 07-19-2005 10:23 AM
SQLDataAdapter lost (along with SQLConnection) - HELP!!! Randy Smith ASP .Net 3 05-05-2005 12:10 AM
SQLConnection Help Claudiu Tescu ASP .Net 1 03-31-2005 09:37 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57