Ado.net and mdi form

  • Thread starter Thread starter JFB
  • Start date Start date
J

JFB

Hi,
Can I define just one connection string in the MDI form and use it in all
the forms?
Or Do I need to create a connection for each form?
Tks
JFB
Private connectionString As String = "Data Source=SQLServer;Initial
Catalog=DBName;user=sa;password=pass"
 
JFB said:
Hi,
Can I define just one connection string in the MDI form and use it in
all the forms?
Or Do I need to create a connection for each form?
Tks
JFB
Private connectionString As String = "Data
Source=SQLServer;Initial Catalog=DBName;user=sa;password=pass"

You can pass the connection or only the connectionstring.
 
in addition
if you declare the string in your parent form as public shared you can
access it from the other forms 2
 
JFB said:
Tks for reply Armin,
How can I pass the the connectionstring?
Sorry but I'm new....
JFB

You can write a procedure. A procedure can have arguments. An argument is
something you pass to the procedure. In this case it is the connection
string.

http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconArguments.asp

Alternatively, you can add a property to the object that needs the string.
By setting the property the object also gets the string.

http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconWritingProperties.asp

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Tks for reply Eric,
I just declare my connection like below but looks like is not declare in my
child form. Do I need to do something special in my child form?
JFB
Public Shared connectionString As String = "DataSource=SQLServer;Initial
Catalog=DBName;user=sa;password=pass"
 
Cool.. tks for the info folks
JFB

JFB said:
Tks for reply Eric,
I just declare my connection like below but looks like is not declare in my
child form. Do I need to do something special in my child form?
JFB
Public Shared connectionString As String = "DataSource=SQLServer;Initial
Catalog=DBName;user=sa;password=pass"
 
Back
Top