connection string syntax in page using config file

Discussion in 'ASP .Net' started by D. Shane Fowlkes, Feb 8, 2006.

  1. I'm trying out a whole bunch of new (to me) techniques. Using asp.net 2
    (vb), can someone correct my connection syntax. The problem seems to be
    that I'm not properly referening the config settings in my aspx page.

    Thanks!

    Compiler Error Message: BC30456: 'connectionStrings' is not a member of
    'Configuration'.

    strConnectString = System.configuration.connectionStrings("DRPTWeb")



    My web.config file:

    <configuration>

    <connectionStrings>

    <add name="DRPTWeb" connectionString="Data Source=DRPT-DEV01;Initial
    Catalog=DRPT....etc....." providerName="System.Data.SqlClient" />

    </connectionStrings>
     
    D. Shane Fowlkes, Feb 8, 2006
    #1
    1. Advertising

  2. It should be
    System.Configuration.ConfigurationManager.ConnectionStrings("DRPTWeb").
    --
    Christopher A. Reed
    "The oxen are slow, but the earth is patient."

    "D. Shane Fowlkes" <> wrote in message
    news:%...
    > I'm trying out a whole bunch of new (to me) techniques. Using asp.net 2
    > (vb), can someone correct my connection syntax. The problem seems to be
    > that I'm not properly referening the config settings in my aspx page.
    >
    > Thanks!
    >
    > Compiler Error Message: BC30456: 'connectionStrings' is not a member of
    > 'Configuration'.
    >
    > strConnectString = System.configuration.connectionStrings("DRPTWeb")
    >
    >
    >
    > My web.config file:
    >
    > <configuration>
    >
    > <connectionStrings>
    >
    > <add name="DRPTWeb" connectionString="Data Source=DRPT-DEV01;Initial
    > Catalog=DRPT....etc....." providerName="System.Data.SqlClient" />
    >
    > </connectionStrings>
    >
    >
    >
    >
    >
    >
    >
    >
     
    Christopher Reed, Feb 11, 2006
    #2
    1. Advertising

  3. D. Shane Fowlkes

    Teemu Keiski Guest

    strConnectString =
    System.Configuration.ConfigurationManager.ConnectionStrings("DRPTWeb").ConnectionString

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke

    "Christopher Reed" <> wrote in message
    news:...
    > It should be
    > System.Configuration.ConfigurationManager.ConnectionStrings("DRPTWeb").
    > --
    > Christopher A. Reed
    > "The oxen are slow, but the earth is patient."
    >
    > "D. Shane Fowlkes" <> wrote in message
    > news:%...
    >> I'm trying out a whole bunch of new (to me) techniques. Using asp.net 2
    >> (vb), can someone correct my connection syntax. The problem seems to be
    >> that I'm not properly referening the config settings in my aspx page.
    >>
    >> Thanks!
    >>
    >> Compiler Error Message: BC30456: 'connectionStrings' is not a member of
    >> 'Configuration'.
    >>
    >> strConnectString = System.configuration.connectionStrings("DRPTWeb")
    >>
    >>
    >>
    >> My web.config file:
    >>
    >> <configuration>
    >>
    >> <connectionStrings>
    >>
    >> <add name="DRPTWeb" connectionString="Data Source=DRPT-DEV01;Initial
    >> Catalog=DRPT....etc....." providerName="System.Data.SqlClient" />
    >>
    >> </connectionStrings>
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>

    >
    >
     
    Teemu Keiski, Feb 11, 2006
    #3
  4. I stand corrected. I'm still use the hash functionality of AppSettings from
    1.x.
    --
    Christopher A. Reed
    "The oxen are slow, but the earth is patient."

    "Teemu Keiski" <> wrote in message
    news:%...
    > strConnectString =
    > System.Configuration.ConfigurationManager.ConnectionStrings("DRPTWeb").ConnectionString
    >
    > --
    > Teemu Keiski
    > ASP.NET MVP, AspInsider
    > Finland, EU
    > http://blogs.aspadvice.com/joteke
    >
    > "Christopher Reed" <> wrote in message
    > news:...
    >> It should be
    >> System.Configuration.ConfigurationManager.ConnectionStrings("DRPTWeb").
    >> --
    >> Christopher A. Reed
    >> "The oxen are slow, but the earth is patient."
    >>
    >> "D. Shane Fowlkes" <> wrote in message
    >> news:%...
    >>> I'm trying out a whole bunch of new (to me) techniques. Using asp.net 2
    >>> (vb), can someone correct my connection syntax. The problem seems to
    >>> be that I'm not properly referening the config settings in my aspx page.
    >>>
    >>> Thanks!
    >>>
    >>> Compiler Error Message: BC30456: 'connectionStrings' is not a member of
    >>> 'Configuration'.
    >>>
    >>> strConnectString = System.configuration.connectionStrings("DRPTWeb")
    >>>
    >>>
    >>>
    >>> My web.config file:
    >>>
    >>> <configuration>
    >>>
    >>> <connectionStrings>
    >>>
    >>> <add name="DRPTWeb" connectionString="Data Source=DRPT-DEV01;Initial
    >>> Catalog=DRPT....etc....." providerName="System.Data.SqlClient" />
    >>>
    >>> </connectionStrings>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Christopher Reed, Feb 11, 2006
    #4
  5. D. Shane Fowlkes

    Teemu Keiski Guest

    Yeah, it's quite easy to forget that when trying v2.0 way.

    Teemu

    "Christopher Reed" <> wrote in message
    news:%...
    >I stand corrected. I'm still use the hash functionality of AppSettings
    >from 1.x.
    > --
    > Christopher A. Reed
    > "The oxen are slow, but the earth is patient."
    >
    > "Teemu Keiski" <> wrote in message
    > news:%...
    >> strConnectString =
    >> System.Configuration.ConfigurationManager.ConnectionStrings("DRPTWeb").ConnectionString
    >>
    >> --
    >> Teemu Keiski
    >> ASP.NET MVP, AspInsider
    >> Finland, EU
    >> http://blogs.aspadvice.com/joteke
    >>
    >> "Christopher Reed" <> wrote in message
    >> news:...
    >>> It should be
    >>> System.Configuration.ConfigurationManager.ConnectionStrings("DRPTWeb").
    >>> --
    >>> Christopher A. Reed
    >>> "The oxen are slow, but the earth is patient."
    >>>
    >>> "D. Shane Fowlkes" <> wrote in message
    >>> news:%...
    >>>> I'm trying out a whole bunch of new (to me) techniques. Using asp.net
    >>>> 2 (vb), can someone correct my connection syntax. The problem seems
    >>>> to be that I'm not properly referening the config settings in my aspx
    >>>> page.
    >>>>
    >>>> Thanks!
    >>>>
    >>>> Compiler Error Message: BC30456: 'connectionStrings' is not a member of
    >>>> 'Configuration'.
    >>>>
    >>>> strConnectString = System.configuration.connectionStrings("DRPTWeb")
    >>>>
    >>>>
    >>>>
    >>>> My web.config file:
    >>>>
    >>>> <configuration>
    >>>>
    >>>> <connectionStrings>
    >>>>
    >>>> <add name="DRPTWeb" connectionString="Data Source=DRPT-DEV01;Initial
    >>>> Catalog=DRPT....etc....." providerName="System.Data.SqlClient" />
    >>>>
    >>>> </connectionStrings>
    >>>>
    >>>>
    >>>>
    >>>>
    >>>>
    >>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Teemu Keiski, Feb 11, 2006
    #5
    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. Replies:
    0
    Views:
    1,649
  2. Mark Rae
    Replies:
    0
    Views:
    407
    Mark Rae
    Jan 10, 2007
  3. =?Utf-8?B?UGF1bA==?=

    using a connection string from the web.config file?

    =?Utf-8?B?UGF1bA==?=, Jan 10, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    370
    =?Utf-8?B?UGF1bA==?=
    Jan 10, 2007
  4. CSharpner
    Replies:
    0
    Views:
    1,145
    CSharpner
    Apr 9, 2007
  5. Replies:
    3
    Views:
    866
    Samuel R. Neff
    Aug 3, 2007
Loading...

Share This Page