none
problem default value for linq to sql RRS feed

  • Question

  • I am having a problem with the default behavior of linq to sql when I added a new table to the app.dbml file to an existing C# 2010 web form app. . The application changed the connection string from appConnectionString (Settings) to OtherConnectionString (Settings).

    I am trying to get the app.dbml file file to allow me to change it back to appConnectionString (Settings). However the designer is not allowing me to do that unless i create a new connection string.

    Basically I am opening the  app.dbml file so I can see the designer. From here I click on properties and I see the connection string settings.

    Thus can you tell me how I can get access to change the setting back to  appConnectionString (Settings)?

    Friday, July 6, 2012 8:16 PM

Answers

  • Are you saying that, when you add new table from ServerExplorer [drag-drop] to DBML designer, the application change the connection string?

    For that case DBML will change the connection according to which DB source you are dragging and dropping from.


    If you want to change the connection string of a DBML, "you know what you are doing" mode, open the DBML's designer.cs and look for this kind of code

    global::System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionStringName"]

    where you can set any connection string name from web.config file.

    Hope this helps.

    • Marked as answer by scamper_cat Sunday, July 8, 2012 3:57 PM
    Sunday, July 8, 2012 3:10 AM