Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > connectionstring

Reply
Thread Tools

connectionstring

 
 
Tony Johansson
Guest
Posts: n/a
 
      01-04-2010
Hello!

I changed in the configurationsettings for ASP.NET so the connection string
element below was saved in my web.config file

I just want to make it clear to me what this element <remove
name="LocalSqlServer" /> that exist in the beginning of the
connectionstrings element actually mean.

My first question is:
I mean that what it say is that forget everytning what is said from the
connectionstring named
LocalSqlServer. Is that correct understood ?

My second question is: If I remove this element <remove
name="LocalSqlServer" />
from my connectionstrings element can that cause problem in any way or is it
100% save to remove it.
If not 100% save can you say anything what might happen

<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="data
source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspn etdb.mdf;"
providerName="System.Data.SqlClient" />
</connectionStrings>

//Tony


 
Reply With Quote
 
 
 
 
imransyed63 imransyed63 is offline
Member
Join Date: May 2006
Posts: 31
 
      01-04-2010
By default, the machine.config will have the "LocalSqlServer" with some default connection string which gets loaded everytime when your application is running. If you want to use the same name "LocalSqlServer" to define your own connectionstring, you need to remove the entry added by machine.config as duplicate entry is not allowed in connection strings and for that purpose you have to use <remove name="LocalSqlServer"> in your web.config.
FYR, msdn.microsoft.com/en-us/library/bf7sd233.aspx
 

Last edited by imransyed63; 01-04-2010 at 07:05 AM..
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic OleDbConnection1.ConnectionString Frank ASP .Net 1 03-06-2005 02:56 PM
ConnectionString - best practices ques G. Dean Blake ASP .Net 2 06-04-2004 06:56 AM
Can't write to db, Connectionstring problem? Lars Netzel ASP .Net 1 05-14-2004 06:45 AM
ConnectionString Initialization josephrthomas ASP .Net 5 12-23-2003 09:23 PM
Re: [ASP.NET] MS SQL Connectionstring Carl Prothman [MVP] ASP .Net 0 07-11-2003 08:55 PM



Advertisments