Can't retrieve appSettings

  • Thread starter Thread starter mike
  • Start date Start date
M

mike

Hello.

I'm creating a class library. I've added an App.Config that looks like the
file at the end of this email.

I've tried just about everything to retrieve the ConnectionString in the
classes constructor but have had no success - I get "Nothing". I'm going
nuts.

How do I get the connection string?

Thanks in advance,

Mike

Here it is:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<appSettings>

<add key="ConnectionString" value="Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=False;Initial Catalog=SessionState;Data
Source=DPWEBDEVHOST;Use Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=DP2243;Use Encryption for Data=False;Tag with
column collation when possible=False"/>

</appSettings>

</configuration>
 
mike said:
Hello.

I'm creating a class library. I've added an App.Config that looks like the
file at the end of this email.

I've tried just about everything to retrieve the ConnectionString in the
classes constructor but have had no success - I get "Nothing". I'm going
nuts.

How do I get the connection string?

Thanks in advance,

Mike

Here it is:


Verify that the config file you want to use is in the same directory as
the executing assembly, for example if your app is called "myapp.exe"
there should be a config file in "bin" called myapp.exe.config.
 
Keywords that he wrote is "class library". You cannot use an app config
file for a .dll. Only .exe.

Jason Newell
 
Back
Top