How do the connection work?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I just try to create a system under the VB .net with teh ADO .net. I found
that i need to create a sqlconnection in each form. They all have the same
connection string (connect to the same database). Is any way to create one
connection and it work for all form?
 
Hi,

No, not at design time.
Anyway, there is nothing wrong of having multiple connection instances.
Just make sure that you keep them open as briefly as possible.
 
The problem with having a common connection (and you can) is that it can
only be used by one form at a time. If you can make sure this is the case,
you can create a Connection object in a module so it's visible to all forms.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top