Connection String Format

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
 
K

Kevin Spencer

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.
 
Z

zeyais

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.
 
J

Jim McGivney

My work-around:
I use three different appSettings keys, and then retrieved and combined them
in the C# code.
Thanks for yor help.
Jim
 

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,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top