Can't retrieve appSettings

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>
 
R

Rob Schieber

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.
 
J

Jason Newell

Keywords that he wrote is "class library". You cannot use an app config
file for a .dll. Only .exe.

Jason Newell
 
M

mike

I was thinking along those lines but couldn't find the documentation.

Thanks Jason.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top