Skip to content

C# create new linq to sql file problem

scampercat

Asked Jul 6, 2012, 4:25 PM EDT2 answers
Share
LinkedInX
In a C# 2010 web form application, I created a new linq to sql (*.dbml) file. When this occurred, the .net framework created a default connection string. However I want the *.dml file to use the connection string I specify.

to solve this problem, I have the following questions:

1. When I do create a new .dbml file, how to I make the .net framework use the connection string I want to use and not come up with a default connection string?

2. For an existing .dbml file that I added to the application, how can I change the default connection string to the value I really want to be used?

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi,
    I hope you have declared the connection string in your web.config file.
    Edit your dbml file in such a way that always it takes the connection string credentials from the web.config file using System.WebConfiguration.AppSettings namespace

    Thanks
    Buy Lace
    0
  • 0
    Can you show me some code on how to accomplish what you are suggesting?
    0