I am working on a C# .NET application that uses LINQ to SQL for database access. Unfortunately, I have spent the past 4 hours trying to get the application to work on my home network. I have brought the application home before for development without issues and transferred the changes back to work. However, this evening I continued to have issues with database access and noticed that the connection string in my DAO was referencing my work ComputerName/Instance. I searched my entire solutions for my work PC Name (i.e. BEN-Laptop) and I also used Windows advanced search options to search my entire directory. However, I could not find any references to my work PC. When I brought the application home to work on I changed all connection string values from my work pc to my home pc and I do not understand why the connection string in the DAO is somehow still referencing my work PC and SQL instance. Is this information cached somewhere because I am at a loss.
Share
If you open up your dbml file in design view and view the properties (F4) you should find a ConnectionString property. When you expand the list of available connection strings it should tell you the source of each string. It’s most likely coming from the settings file. (~\Properties\Settings.settings)
Ideally when you create a data context you should use the constructor which takes a connection string and you will know exactly where it’s coming from.