web.config file error

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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
 
Back
Top