global connection string

  • Thread starter Thread starter Mike P
  • Start date Start date
M

Mike P

What is the equivalent of setting a global connection string in
Web.Config in WinForms?


Any help would be really appreciated.


Cheers,

Mike
 
Mike,

You would want to add a key/value pair to the app.config file.

Hope this helps.
 
What is the equivalent of setting a global connection string in
Web.Config in WinForms?

WebForms apps have Web.config - WinForms apps have app.config.

They work in the same way i.e. name/value pairs.

Alternatively, you could add a public sealed class into a class module e.g.

public sealed class CGlobal
{
public const string strTest = "Hello Mike";
}

Then, you can refer to the public constants anywhere else in your code just
by writing something like:

string strGlobalTest = CGlobal.strTest;

You don't even need to set a reference to it.
 
Hi Mike,


You have app.config , it's the same thing :)

Cheers,
 
Where is the app.config file? It's not in my app folder...do I need to
create it manually?


Thanks,

Mike
 
Back
Top