Jesper Evertsson Jesper Evertsson - 13 days ago 9
C# Question

Trying to import an existing database to VS using Entity framework

So, Im trying to learn a lot of database related programming since there seem to be a lot of job openings doing that sort of programming. I've spent som time with MS SQL Server and now I've moved on to trying to learn the Entity Framwork. I have created a small database with MS SQL Server and now I want to use it in a Visual Studio project.

The problem is that when I add a new "ADO.NET Entity Data Model" to my project and select "Generate from database" I have to select a data connection. In every single tutoral they can just choose from a drop down list, but my list is empty. I've tried to create a "New connection..." but I have no idea which option to choose. "Microsoft SQL Database File" seemed logical, but when I do that and then select my databasefile it says that I don't have the rights to access it(I'm the admin). I've also tried selecting "Microsoft SQL Server" as my data source. Then I can add my server name from the drop down list but the "Select or enter a database name" drop down list is empty and if I enter my database name manually I get some connection error

So yea, basically I need help with setting up a new data connection in the Entity Data Model Wizard

Answer

Enter the Server Name and have a try with "Test Connection". If it throws an error, either the MS SQL Server is not at the specified location or you have to specify login credentials (Use SQL Server Authentication).