web.config - connection string

  • Thread starter Jim McGivney - Office
  • 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
 
R

Raul Macias

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
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top