Connection string not working

T

tshad

In VS 2008, I am trying to get my connection from my web.config file but it
is coming up empty.

My code:

Dim ConnectionString As String =
System.Configuration.ConfigurationManager.AppSettings("AssociatesConnectionString")

ConnectionString is nothing after this line.

My web.config has it set as:

<connectionStrings>
<add name="AssociatesConnectionString" connectionString="Data
Source=PTERADON\AW3000_INSTANCE;Initial
Catalog=CSpearAndAssociates;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

Why doesn't it pick up this value?

Thanks,

Tom
 
T

tshad

Figured it out.

It needs to be:

System.Configuration.ConfigurationManager.ConnectionStrings("AssociatesConnectionString").ConnectionString

Thanks,

Tom
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top