Q&A

Q1:I have an application where I am constantly accessing the database. I think it would be easier just to make one connection; then I don't have to bother with making a new connection every time. Is this the best way?
A1: Actually, this would be a very costly process. You would be making a dedicated connection that no one else could use. You might think that it will cost more to make a connection every time, but, although your code may be calling a Connection.Open, connection pooling is going on in the background. This holds onto connections for a little time, even after the calling program may have closed them. If another user or application asks for that connection, it merely gives it the existing connection. This allows a much smaller ...

Get Sams Teach Yourself Microsoft® Windows® DNA Programming in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.