Stuck on WebConfigurationManager

J

Jonathan Crawford

Hi

I have been using 1.1 .Net for ages but have moved to 2.0 on VS2008

I added a connection to the wb config file
eg like
<connectionStrings>
<add name="Pubs"
connectionString="Server=(local)\SQLExpress;Integrated
Security=True;Database=pubs;Persist Security Info=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

I have a class
In my class I try and access this connection string using the following
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports System.Configuration
Imports System.Web.Configuration

I have referenced system web configuration and System.Configuration.dll

WHen i try to pick up the value
Private _connectionString As String =
WebConfigurationManager.ConnectionStrings["SQLConnectionString"].ConnectionString

However under the " before SQLConnectionStringis highlighted and "Identifier
is required" and the thing won't compile.

I am truly stuck and my head is about to explode
How can somethign so simple be so difficult

any help appreciated

jc
 

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,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top