0

I'm trying to add a database to a C# Windows Form application using Entity Framework 6 database first model. When I publish it using Microsoft Visual Studio Installer projects the database is not attached to the application.

How can I deploy an .mdf database along with the application executable?

attached DB and connection string

exception thrown

8
  • 1
    First you have to understand windows form application need database same as your development env that mean you have to install sql express or set an server if more client. either can use Sql light database which is not required any databse setup. c-sharpcorner.com/UploadFile/5d065a/… Commented Nov 30, 2019 at 9:14
  • 1
    Second SQL files like .mdf check the path where your application can access as development env working like some folder name or AppData something like Commented Nov 30, 2019 at 9:17
  • understood nothing, please clarify your answer and take a look again at the question and at the pictures attached. Commented Nov 30, 2019 at 10:02
  • Hi Sam313 and welcome to Stack Overflow! I've edited your answer to make it more concise and to make the images visible. I've also edited the title to put the actual error. Please consider including the text of the exception and the connection string, not the image. This will make even easier to find and understand your question for everyone. Commented Dec 1, 2019 at 6:56
  • @Sam313 parte of the review process is to give new users suggestion on how to rephrase questions. On meta you can find useful insights on this process meta.stackoverflow.com/questions/287466/… please if possible add text of exception an connection string Commented Dec 1, 2019 at 10:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.