connectionstring

Discussion in 'ASP .Net' started by Tony Johansson, Jan 4, 2010.

  1. 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|aspnetdb.mdf;"
    providerName="System.Data.SqlClient" />
    </connectionStrings>

    //Tony
     
    Tony Johansson, Jan 4, 2010
    #1
    1. Advertising

  2. Tony Johansson

    imransyed63

    Joined:
    May 16, 2006
    Messages:
    27
    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: Jan 4, 2010
    imransyed63, Jan 4, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carl Prothman [MVP]

    Re: [ASP.NET] MS SQL Connectionstring

    Carl Prothman [MVP], Jul 11, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    6,504
    Carl Prothman [MVP]
    Jul 11, 2003
  2. Frank
    Replies:
    1
    Views:
    1,631
    Robbe Morris [C# MVP]
    Mar 6, 2005
  3. josephrthomas

    ConnectionString Initialization

    josephrthomas, Dec 23, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    4,166
    Simon Aspden
    Dec 23, 2003
  4. Lars Netzel
    Replies:
    1
    Views:
    1,044
    Lars Netzel
    May 14, 2004
  5. G. Dean Blake

    ConnectionString - best practices ques

    G. Dean Blake, Jun 3, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    3,620
    Saravana [MVP]
    Jun 4, 2004
Loading...

Share This Page