0

I am going through a tutorial that is adding a simple local database to a C# console application but when adding a new item to the solution I cannot find the Local Database to insert a .sdf database file. I have tried to download SQL Server Compact 4.0 but upon installation it says that SQL Server Compact 4.0 is already installed on the computer. Below is a screenshot of the available data resources I can add. enter image description here

How would I be able to add a local database file to my solution?

Rossco
  • 3,563
  • 3
  • 24
  • 37
  • SQL Server Compact has been discontinued in VS2013. You could use `LocalDB` instead. – Salah Akbari Mar 01 '16 at 13:55
  • @S.Akbari I have LocalDB installed on my pc but still cant add a new "Local Database" to my solution. None of the options allow for a .sdf database. – Rossco Mar 01 '16 at 14:18
  • Possible duplicate of [How to connect to LocalDB in Visual Studio Server Explorer?](http://stackoverflow.com/questions/21563940/how-to-connect-to-localdb-in-visual-studio-server-explorer) – Smandoli Apr 08 '16 at 14:40

2 Answers2

0

You should use the ADO.NET Entity Data Model and use Entity Framework to generate models from your database. You can select your local database there.

Robinhopok
  • 297
  • 2
  • 13
  • Problem is I cannot create a local database in my solution. The ADO.NET EF requires there to be an existing DB – Rossco Mar 01 '16 at 14:11
0

Eventually found this question that has already been answered that solved my problem

How to connect to LocalDB in Visual Studio Server Explorer?

Community
  • 1
  • 1
Rossco
  • 3,563
  • 3
  • 24
  • 37