G
Guest
I want to use an Application Configuration file (App.config) to store the
connection string for a .Net Class Library project.
This is the App.Config file...
<?xml version="1.0" ?>
<configuration>
<appSettings>
<add key="ConnectionString" value="MyConnectionString" />
</appSettings>
</configuration>
....and this is the code I'm using to access the setting...
dim str as string =
System.Configuration.ConfigurationSettings.AppSettings("ConnectionString").ToString
....but this is the error I'm getting...
An unhandled exception of type 'System.NullReferenceException' occurred in
MyLibrary.dll
Any ideas why ?
Craig
connection string for a .Net Class Library project.
This is the App.Config file...
<?xml version="1.0" ?>
<configuration>
<appSettings>
<add key="ConnectionString" value="MyConnectionString" />
</appSettings>
</configuration>
....and this is the code I'm using to access the setting...
dim str as string =
System.Configuration.ConfigurationSettings.AppSettings("ConnectionString").ToString
....but this is the error I'm getting...
An unhandled exception of type 'System.NullReferenceException' occurred in
MyLibrary.dll
Any ideas why ?
Craig