all groups > c# > july 2005 >
You're in the

c#

group:

ADO.NET connection string in windows application


ADO.NET connection string in windows application Lloyd S
7/1/2005 10:58:02 PM
c#:
I was wondering how you can place a connection string to a database in a
windows application in one place so that it can be referenced easily from
anyplace in the code where a database connection is needed. I want to be
able to access the string value after it has been deployed so I can change
the string to point to any database. Should I use some sort of include file?
Or something else? I know in ASP.NET you can use an application variable.
But what do you use for a Windows application?
--
Re: ADO.NET connection string in windows application Chad Z. Hower aka Kudzu
7/2/2005 11:52:33 AM
"=?Utf-8?B?TGxveWQgUw==?=" <LloydS@discussions.microsoft.com> wrote in
news:E2CE4F0B-28DD-4101-AAC4-63760CF91D81@microsoft.com:
[quoted text, click to view]

You can declare a static on a an object.

[quoted text, click to view]

You should use the app.config, or something like this:
http://www.codeproject.com/dotnet/XMLSettingsFile.asp




--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
AddThis Social Bookmark Button