connection string, how to?

  • Thread starter Thread starter CSharp
  • Start date Start date
C

CSharp

Hello all,

I store the connection string in my web.config like this:

<appSettings>
<add key="ConnectionString"
value="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\inetput\wwwroot\testapp\DB\gb.mdb;" />
</appSettings>

Instead of hardcoding the path of the db file, I want to specify the
relative path. My db is in the DB subfolder of my application folder. How
can I do this?

Thanks
SeeSharp
 
Give the relative path in separate key/value pair. At runtime, resolve the
location using Server.MapPath(relative_path) and concatenate the resulted
path with the original ConnectionString to construct the complete connection
string.
 
Thanks

SeeSharp

Teemu Keiski said:
Give the relative path in separate key/value pair. At runtime, resolve the
location using Server.MapPath(relative_path) and concatenate the resulted
path with the original ConnectionString to construct the complete connection
string.
 
Back
Top