0

I want to create a local Database with my C# Project. The Database should be saved in the Projec file, so if I the Programm to another PC, the Data is kept. I tried to add a Database. Everything is fine BUT if I create a Table in the Database, i cant save it in my Project, I have to save it externally. I dont know if you understand what i mean, but here are some pictures that can maybe help understanding me.

This is the Database I added to the Project. Everything fine.

enter image description here

If I double click on it I get this Window:

enter image description here

If I click on "Tables" (In this picture it's named "Tabellen") and then "Create New". I get this Window:

enter image description here

Everything fine so far. But when I want to save it, I cant save it in the Project. I have to save it externally. So my Questions are:

  • HOW can I save it in my Project
  • AND HOW can I work with it in my Project?

Hope all of you understood what I want :D, sorry for my bad explanation and my bad englisch ;)

1
  • Why can't you save it? What happens at this moment? What error does it show? Commented Jun 28, 2020 at 12:51

1 Answer 1

1

If I were you I'd spend some time learning Entity Framework Code First, add to my project, and have the code build your database on deploy/startup. If you need seeds, have in code (application startup) some insert statements to populate and seed the data so the next workstation or the next programmer who works on your code or works with you get a clean install of a SQL db, with enough data in it to function.

This also makes it really easy to deploy to production. The code would start for the first time and voila you have a new SQL db and code so the app functions.

For each individual deploy, or each person using it all they need to do is point the web.config SQL Connection string to a local db. In production you point the SQL to a production SQL db, with proper credentials.

IMHO

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.