web.config - connection string

Discussion in 'ASP .Net' started by Jim McGivney - Office, Oct 20, 2005.

  1. I have a C# project with multiple aspx pages, each with an olebdDataAdaptor
    and olebdConnection. Is it possible to place the connection string that the
    olebdConnections will use in the web.config file ? Every olebdConnection
    uses the same connection string.
    Sample code would be appreciated.
    Thanks in advance for your help,
    Jim
    Jim McGivney - Office, Oct 20, 2005
    #1
    1. Advertising

  2. Jim McGivney - Office

    Raul Macias Guest

    you can add a new key into the application settings of your web.config file:

    <configuration>
    <appSettings>
    <add key="connString" value="xyz" />
    ...
    </configuration>
    </appSettings>

    then you can read the value from your pages like this:

    string myConnString = System.Configuration.AppSettings["connString"];

    -Raul

    "Jim McGivney - Office" <> wrote in message
    news:...
    >I have a C# project with multiple aspx pages, each with an olebdDataAdaptor
    >and olebdConnection. Is it possible to place the connection string that
    >the olebdConnections will use in the web.config file ? Every
    >olebdConnection uses the same connection string.
    > Sample code would be appreciated.
    > Thanks in advance for your help,
    > Jim
    >
    Raul Macias, Oct 20, 2005
    #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:
    541
    Michelle A.
    Aug 20, 2003
  2. Replies:
    4
    Views:
    13,568
  3. Replies:
    0
    Views:
    766
  4. CSharpner
    Replies:
    0
    Views:
    992
    CSharpner
    Apr 9, 2007
  5. Replies:
    3
    Views:
    836
    Samuel R. Neff
    Aug 3, 2007
Loading...

Share This Page