Click here to Skip to main content
15,898,035 members
Home / Discussions / C#
   

C#

 
GeneralDotNet version problem Pin
azusakt18-Apr-04 16:09
azusakt18-Apr-04 16:09 
GeneralRe: DotNet version problem Pin
scadaguy18-Apr-04 16:49
scadaguy18-Apr-04 16:49 
Generalwindows media web control Pin
Marveyles18-Apr-04 15:11
Marveyles18-Apr-04 15:11 
GeneralRe: windows media web control Pin
Heath Stewart19-Apr-04 4:09
protectorHeath Stewart19-Apr-04 4:09 
Generalc# oledbdataadapter using access db and asp Pin
MeterMan18-Apr-04 13:23
MeterMan18-Apr-04 13:23 
GeneralRe: c# oledbdataadapter using access db and asp Pin
Heath Stewart19-Apr-04 4:10
protectorHeath Stewart19-Apr-04 4:10 
GeneralRe: c# oledbdataadapter using access db and asp Pin
MeterMan19-Apr-04 4:28
MeterMan19-Apr-04 4:28 
GeneralRe: c# oledbdataadapter using access db and asp Pin
Heath Stewart19-Apr-04 5:18
protectorHeath Stewart19-Apr-04 5:18 
If you don't know what something is, please read the documentation. It will tell you a lot of information.

The <appSettings> section of a .config file stores key/value pairs. Simply use some name you can easily refer to and include the full path to the database (I strongly recommend you keep it OUT of the publicly-accessible web directories):
<configuration>
  <appSettings>
    <add key="DBPath" value="C:\SomeDir\File.mdb"/>
  </appSettings>
</configuration>
When you need the path, use something like:
string dbPath = ConfigurationSettings.AppSettings["DBPath"];
Don't forget to check for null returns.

This allows you to change the path in your .config file at any time. For Windows applications, you need to restart the application. For ASP.NET, changes to the Web.config file restart the ASP.NET web application automatically, which reads-in the new values when necessary.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: c# oledbdataadapter using access db and asp Pin
Heath Stewart19-Apr-04 4:11
protectorHeath Stewart19-Apr-04 4:11 
GeneralPanels and transparency Pin
Flack18-Apr-04 10:01
Flack18-Apr-04 10:01 
GeneralRe: Panels and transparency Pin
Dave Kreskowiak18-Apr-04 12:53
mveDave Kreskowiak18-Apr-04 12:53 
Generaladding new user Pin
emysola18-Apr-04 8:50
emysola18-Apr-04 8:50 
GeneralRe: adding new user Pin
Roman Rodov18-Apr-04 16:02
Roman Rodov18-Apr-04 16:02 
GeneralArray List Pin
Member 95766518-Apr-04 6:16
Member 95766518-Apr-04 6:16 
GeneralRe: Array List Pin
Stefan Troschuetz18-Apr-04 6:51
Stefan Troschuetz18-Apr-04 6:51 
GeneralGet table names in an Access .mdb database Pin
BillAnton18-Apr-04 5:50
BillAnton18-Apr-04 5:50 
GeneralRe: Get table names in an Access .mdb database Pin
Mike Ellison18-Apr-04 19:33
Mike Ellison18-Apr-04 19:33 
GeneralRe: Get table names in an Access .mdb database Pin
Mike Ellison18-Apr-04 19:35
Mike Ellison18-Apr-04 19:35 
GeneralRe: Get table names in an Access .mdb database Pin
BillAnton19-Apr-04 8:37
BillAnton19-Apr-04 8:37 
GeneralReading an ini file Pin
mcgahanfl18-Apr-04 5:27
mcgahanfl18-Apr-04 5:27 
GeneralRe: Reading an ini file Pin
CWIZO18-Apr-04 7:01
CWIZO18-Apr-04 7:01 
GeneralRe: Reading an ini file Pin
kratchkov18-Apr-04 10:02
kratchkov18-Apr-04 10:02 
GeneralRe: Reading an ini file Pin
mcgahanfl18-Apr-04 11:24
mcgahanfl18-Apr-04 11:24 
Generala narrow, veritical dialog Pin
mcgahanfl18-Apr-04 5:23
mcgahanfl18-Apr-04 5:23 
GeneralRe: a narrow, veritical dialog Pin
Jon G19-Apr-04 1:06
Jon G19-Apr-04 1:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.