I thought the monitor would reset the timers? Or am I completely wrong on that one? I'll test it out and see. Thanks for the ideas though!
=Blain -----Original Message----- From: The DOTNET list will be retired 7/1/02 [mailto:[EMAIL PROTECTED]] On Behalf Of Marina Zlatkina Sent: Wednesday, June 05, 2002 11:22 AM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Connection Question Why is it not easy? Monitor.Enter(myConObject) myAdapter.Fill(myDataSet) Monitor.Exit(myConObject) This should ensure that only one thread has a lock on the connection object at a time, avoiding the possibility that two try to get data using the same connection object at the same time. I think connection pooling is more related to having a bunch of connections available for the use of the application, so the overhead of creating and disposing of each one is avoided. But here you are creating just one connection, and using it over and over, so I don't think it's applicable. On Wed, 5 Jun 2002 11:00:06 -0400, Blain Timberlake <[EMAIL PROTECTED]> wrote: >Hmm....well I don't think it is quite as easy to do with the monitor. > >What I have is 1 connection, >Two timers using 3 different data adapters, >And 4 sql command objects. > >My *HOPE* was that I could have one connection, and be able to point all >those guys to one connection object. If two or three tried to hit it at >once, I thought the connection pooling would kick in and take whatever >connections it needed. Apparently I did something wrong or >mis-understood a concept there because it doesn't seem to be working. > >Should that work? > >=Blain > >-----Original Message----- >From: The DOTNET list will be retired 7/1/02 >[mailto:[EMAIL PROTECTED]] On Behalf Of Marina Zlatkina >Sent: Wednesday, June 05, 2002 10:31 AM >To: [EMAIL PROTECTED] >Subject: Re: [DOTNET] Connection Question > >To use a DataSet you don't need to open a connection at all. When you >call >the Fill method, the connection will be automatically open and closed >after the fill is performed. > >It is very possible as you suggested that those timers are trying to >execute that code at the same time. You should look into the Monitor >class, which should allow you to insist that only one thread can execute >this piece of code at a time. > >Marina > >You can read messages from the DOTNET archive, unsubscribe from DOTNET, >or >subscribe to other DevelopMentor lists at http://discuss.develop.com. > >You can read messages from the DOTNET archive, unsubscribe from DOTNET, or >subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.