web.config - connection string

  • Thread starter Thread starter Jim McGivney - Office
  • Start date Start date
J

Jim McGivney - Office

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
 
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
 
Back
Top