Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 728767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:43:10+00:00 2026-05-14T06:43:10+00:00

In my development environment, my SQL Server is PHILIP\SQLEXPRESS . In testing, it’s ANNIE

  • 0

In my development environment, my SQL Server is PHILIP\SQLEXPRESS. In testing, it’s ANNIE, and the live environment will have a third name yet to be determined. I would have assumed that updating the following statement in web.config would have been enough:

<add name="MyConnectionString"providerName="System.Data.SqlClient" 
connectionString="Data Source=PHILIP\SQLEXPRESS;Initial Catalog=MyDtabase;Integrated Security=True" />

When using SqlConnection, SqlCommand, SqlDataReader and friends, that’s all it took. Using LINQ, it doesn’t seem to work that nicely. I see the servername repeated in my .dbml file as well as in Settings.settings. After changing it in all of those places, I get it to work. However if I’m doing a few deployments per day during testing, I want to avoid this regimen.

My question is: is there a programmatic solution for LINQ to SQL that will allow me to specify the connection string once, preferably in web.config, and get everybody else to refer to it?

— EDIT —

The following connection statement is in my .dbml file:

<Connection Mode="AppSettings" ConnectionString="Data Source=PHILIP\SQLEXPRESS;
InitialCatalog=MyDatabase;Integrated Security=True" 
SettingsObjectName="MyDatabase_Data_Access_Layer.Properties.Settings" 
SettingsPropertyName="MyConnectionString" Provider="System.Data.SqlClient" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:43:10+00:00Added an answer on May 14, 2026 at 6:43 am

    On your Linq-to-SQL model (the *.dbml file), you should be able to bring up its properties. In the property grid, there is a Connection setting which allows you to specify where and how to store that connection information for Linq-to-SQL. This typically refers to your app.config/web.config. See my sample here:

    alt text

    (full size image at http://i43.tinypic.com/xazbrb.png )

    There’s nothing stopping you from using the very same connection string as your “normal” app uses – actually, that’s quite a good idea, in fact!

    So you should be able to basically change your SQL Server connection string in one place (in your app.config / web.config) and that should be all you need to do! Doesn’t get much easier than that, does it?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL SERVER 2008 R2 on development environment that connect to production
I'm comparing two SQL server databases (development and live environment, SQL2005 and SQL2008 respectively)
My dev environment has SQL Server 2008 installed. I have an asp.net 1.1 site
I work in an ASP.net/ SQL Server development environment. If my only concern is
Development environment is C# 3.5 with a SQL Server 2008 database and Entity Framework.
Currently my development environment is using SQL server express 2008 r2 and VS2010 for
In the software development environment where I work we have a group of developers
we have a mixed development environment using ASP.NET MVC and Ruby on Rails. We
Our CF 9 development environment is on a common development server (DEVWEB). We're looking
I have some inserts in a development environment to release, the developer has not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.