connection string in web.config error

Discussion in 'ASP .Net' started by Matt, Nov 8, 2003.

  1. Matt

    Matt Guest

    I added the connection string in web.config as follows:

    <appSettings>
    <add key="connString" value="Integrated Security=SSPI;Persist Security
    Info=False;Initial Catalog=MY_DATABASE;Data Source=IP_ADDRESS" />
    </appSettings>

    In mypage.aspx.vb page, I open the connection with connString variable:

    Dim conn As New SqlConnection(connString)

    But it has compile error:
    name 'connString' is not declared.

    Any ideas?
    Matt, Nov 8, 2003
    #1
    1. Advertising

  2. System.Configuration.ConfigurationSettings.AppSettings["connString"]

    will return it

    Consider creating a class that returns your connection string. That way if
    later you decided to change your method of storing the string, the change is
    simple.

    Andrew

    "Matt" <> wrote in message
    news:...

    > I added the connection string in web.config as follows:
    >
    > <appSettings>
    > <add key="connString" value="Integrated Security=SSPI;Persist Security
    > Info=False;Initial Catalog=MY_DATABASE;Data Source=IP_ADDRESS" />
    > </appSettings>
    >
    > In mypage.aspx.vb page, I open the connection with connString variable:
    >
    > Dim conn As New SqlConnection(connString)
    >
    > But it has compile error:
    > name 'connString' is not declared.
    >
    > Any ideas?
    >
    >
    >
    Andrew de la Harpe, Nov 8, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michelle A.
    Replies:
    0
    Views:
    551
    Michelle A.
    Aug 20, 2003
  2. Replies:
    4
    Views:
    13,578
  3. Replies:
    0
    Views:
    841
  4. CSharpner
    Replies:
    0
    Views:
    1,019
    CSharpner
    Apr 9, 2007
  5. Replies:
    3
    Views:
    846
    Samuel R. Neff
    Aug 3, 2007
Loading...

Share This Page