Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework Connection wizard cant find my Database

I have a unexpected problem.

I create a database on Sql Server 2012. I want to connect this database using Entity Framework on Visual Studio 2012. But Entity framework wizard can't find Servers.

The steps that I followed;

I clicked to "add New İtem ->Add Ado.Net Entity Data Model.

  1. I chose "Generate From Database" on "model content" page. Clicked Next.
  2. On "choose your model connection" page, I clicked "New connection" button. After this, a new window opened.
  3. On this window, I chose "Microsoft Sql Server" as data source and ".Net Framework Provider for sql server" as data provider. Clicked Continue.
  4. After all of them, a window named as "Connection Properties" opened.

On this page, I have to choose Server Name. Unfortunately, there is no Server Name on server name combobox. I refreshed the list of servers. Still, the list is empty. But, I know I have a server. I worked on this. But the Entity Framework wizard can't find it.

Do you have any idea to overcome this problem ?

Thanks!

like image 429
Sinan Türemiş Avatar asked Apr 11 '14 23:04

Sinan Türemiş


3 Answers

  1. Manually enter the server name and then click on databases
  2. Ideally it should find the list of servers but sometimes it will not, so enter it manually.
  3. Try and verify that from your system you can connect to the database? If not I think you need to enable some SQL services.
like image 117
user3508580 Avatar answered Nov 12 '22 05:11

user3508580


I dont know how relevant it is now but just thought to put this details so that it could be helpful for someone who come across the same problem.

As user3508580 rightly pointed out the VS Entity Data Model Wizard may not list the local db in that case we need to add the Server name manually.

In Visual Studio 2012 the Server Name is:

(localdb)\v11.0

enter image description here In Visual Studio 2015/2017 the Server Name is:

(localdb)\MSSQLLocalDB

enter image description here

To know the details of localDb running in your system you can use SqlLocalDB.exe infocommand in Windows command prompt. It will list the DB's running in the machine.

like image 39
Pabdev Avatar answered Nov 12 '22 04:11

Pabdev


This issue occurs when "SQL Server Browser" Service is not running.

To resolve this follow the following steps:

  1. Click on start and type services.msc. Press enter.
  2. Scroll down untill you find "SQL Server Browser" service.
  3. Right click on it and click "Start".

Now head on to Visual Studio and click on refresh next to server name. voila ! your server name is there.

like image 2
Aman Agarwal Avatar answered Nov 12 '22 06:11

Aman Agarwal