Place connectionString in web.config. Why is not working?

S

Shapper

Hello,

I have this connectionString in a DataReader:
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;
Ole DB Services=-4; Data Source=C:\db.mdb"

It's working fine. Now i replaced this line with this one:
Dim connectionString As String =
System.Configuration.ConfigurationSettings.AppSettings("connectionString")

And I added this in my web.config file:
<appSettings>
<add key="connectionString"
value="Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data
Source=C:\db.mdb" />
</appSettings>

I got this error:
System.InvalidOperationException: The ConnectionString property has
not been initialized.

Why? Am I doing something wrong?

Thank You,
Miguel
 
G

Guest

The code looks correct. Are you sure you don't have another variable called
ConnectionString that is not set up right?

Brendon
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top