mardi 12 avril 2016

MVC pattern. "Could not find the connection string with the name ... in the application configuration file"

my WinForm app realizes MVC pattern and consists of two project. The first one contains View and Controller layers and the second one- Model layer(class library). App has to get information from database (i use MS SQL Server). In the second project (Model layer) i have ADO.NET model, methods to work with the database and appropriate connection string in app.config. But when i run the app and it tries to make a query to the database the error "Could not find the connection string with the name ... in the application configuration file" appears. I guess that when Controller call a Model's method to make a query to the database app tries to find connection string in App.config file of the main project and can't find it there. I think it's not right to create a connection string in the project with Controller and View. How can i solve the problem in the right way?

Aucun commentaire:

Enregistrer un commentaire