Connection String Format

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

Jim McGivney

I am trying to place a connection string in the appSettings section of my
web.config. I use C#.

I get an error message because of the "+" character.

<appSettings>
<!-- DataBase Connection String -->
<add key="connString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" + "C:\Inetpub\wwwroot\Bobo\GfxDB.mdb" + ";User Id=admin;Password=;"
/>
</appSettings>
Any suggestions would be appreciated. Thanks in advance for your help,

Jim
 
Sure. You can only put string literals into a config file.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
Treat this is as XML file. You might also want to check on special
characters that you might want to use. Use encoded characters.

In this case Gaurav already has given a valid anser.
 
My work-around:
I use three different appSettings keys, and then retrieved and combined them
in the C# code.
Thanks for yor help.
Jim
 
Back
Top