Missing Connectionstring for DBML

Published Mon, Sep 22 2008 11:16 AM

I encountered a problem today which in the end had an easy solution, but nevertheless took me over an hour to fix.

Our project had been running for weeks without any problems, but today it suddenly failed with the message:

'ProjectDataContext' does not contain a constructor that takes '0' arguments.

The Connection setting was empty and I couldn't re-select the Connectionstring from the App.Config. If I changed the 'Application Settings' to false the project did build but this wasn't the setting it used to have.

In the end my Settings.settings file was corrupt. Trying to open the settings file gave me the error: "Value does not fall within the expected range".

I deleted the settings file, have the property sheet create a new one and the problem was fixed.

 

Technorati Tags: ,,

Comments

# ecards said on Saturday, January 03, 2009 7:19 PM

The biggest pain is, how to get the designer to use a connection string in a config file?

Every time there is a new table added the connection property is regenerated - this part is crazy.

Lee

# Don said on Sunday, January 04, 2009 3:11 AM

It's unbelievable how fragile the DBML generator is.  Very much appreciate your hint on the settings file.  When I tried to open mine, VS2008 crashed instantly.  Restarting VS2008, closing the DBML window, and restarting VS2008 again fixed my issue (including the crash-producing settings file).

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 2 and 4 and type the answer here: