Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 6th, 2005, 03:22 PM
Authorized User
 
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default setting connection string in the web.config

hi, i'm having troubles in placin' a sql connection string in an appsettings tag in the web.config file.
the problem raise when i set the value attribute in the add key tag.
my connection string includes several "s and i used the token /u2022
where the "s must be placed.
example1:

<appSettings>
<add key="sqlconnString" value="workstation id='\u0022'INFO-7834'\u0022'; packet size=4096;integrated security=SSPI;data source='\u0022'INFO-7834'\u0022';persist security info=True;initial catalog=dbapps">
</appSettings>

i 've also tested:

example 2:

<appSettings>
<add key="sqlconnString" value="workstation id=\"INFO-7834\";packet size=4096;integrated security=SSPI;data source=\"INFO-7834\";persist security info=True;initial catalog=dbapps">
</appSettings>

and...worse for the compiler!!!

for the first snippet of code i got the following exception "Format of the initialization string does not conform to specification starting at index 23" where 23 is the position that is preceded by the first '\u0022' in the first example.
waiting for your help.
 
Old January 6th, 2005, 04:13 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You don't need all the quotes. The semi-colon is used as a separator:

<add key="sqlconnString" value="integrated security=SSPI;data source=INFO-7834;persist security info=True;initial catalog=dbapps">

should do the trick.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 6th, 2005, 04:33 PM
Authorized User
 
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks a lot imar, it worked perfectly!!!good luck!!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Connection String setting at runtime TwoTrees BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 3 July 2nd, 2010 11:41 AM
Setting of web config file epkgupta General .NET 0 July 9th, 2008 09:32 AM
connection string issues, web.config file issues kaliaparijat ASP.NET 2.0 Professional 1 June 12th, 2008 08:07 AM
Setting the Locale within Web.Config rit01 ASP.NET 2.0 Basics 1 March 2nd, 2006 11:06 AM
Variable Path in web.Config Connection String? ElPato General .NET 4 June 21st, 2004 05:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.