Questions That Should Be Asked More Frequently

[Previous] [Next]

Q. If I use only one Connection object, does that mean I'll have only one connection to my database?

A. No. If you ask ADO to accomplish a task and ADO determines that it cannot perform that task because the connection is busy, it will establish a temporary connection to your database in order to complete the task. This behavior is most likely to affect developers using SQL Server who encounter the limitation of one active query per connection. We'll talk about this more in Chapter 7 when we discuss cursors, but keep that distinction in the back of your mind. One Connection object does not equal one connection to your database.

Q. Should I rely on Visual Basic, COM, and ADO garbage collection, or should I close and release objects myself?

A. One memory leak can ruin your whole day. You should not need to worry about collecting your own garbage, but you should do it anyway. Close and release your ADO objects whenever possible.



Programming ADO
Programming MicrosoftВ® ADO.NET 2.0 Core Reference
ISBN: B002ECEFQM
EAN: N/A
Year: 2000
Pages: 131
Authors: David Sceppa

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net