web.config file error

G

Guest

I have a web service and i want it to read the web.confg file for my
database connection.
I keep getting an error on

conn.ConnectionString = ConfigurationSettings.AppSettings("DB")

it says Name ConfigurationSettings is not declared. this is the same line of
code i've taken from my asp.net web app so i know it works. Do i have to do
something different for a web service to read the file?
 
G

Greg Burns

Try Configuration.ConfigurationSettings.AppSettings

or

Imports System.Configuration

Web projects have System.Configuration imported by default (look in your
project properites->Common Properties->Imports). Winform apps don't. Not
sure on webservices...

I think they do this just to try and confuse us. :^)

HTH,
Greg
 

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