2

I have an issue and I cannot find out what the problem is. In visual studio 2010 I'm trying to add a new ADO.NET entity data model through the wizard (I'm using Entity Framework 4.1). After the second wizard step (that says "Choose your Data Connection") I press next and the wizard is closed right away, and there are no following steps at all. Here is my entity connection string:

metadata=res://*/DAL.Model1.csdl|res://*/DAL.Model1.ssdl|res://*/DAL.Model1.msl;provider=System.Data.SqlClient;provider connection string="Data Source=DMITRIY-TOSH\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True"

Is there anything wrong with that connection string? What should I change in it and how? Or what else can be the cause of the problem? Help me with this, please. I don't even know how to make it work to see the next wizard step where I can choose tables.

4
  • How did you get this connection string and how did you tried to use it? When working with wizard you don't use such connection string manually. The wizard will create it for you. Commented Apr 10, 2012 at 7:46
  • That connection string was created by the wizard. I didn't change it in any way. I just copied it. Maybe there's just something wrong with the access restrictions or maybe my .mdf file is located in the wrong place, that's why I placed the connection string here, just in case possible problems can be found in it. Commented Apr 10, 2012 at 7:57
  • Easiest thing to do is use the wizard to create a new connection string. Commented Apr 10, 2012 at 16:53
  • But I do let the wizard create a new connection string. The problem is that the wizard doesn't show the third step where you choose tables. It just closes itself without any errors or warnings. In every tutorial I've seen the third step shows up without problems, but not for me... Commented Apr 10, 2012 at 17:53

3 Answers 3

1

Found the solution. The folder "App_Data" (with the database inside) wasn't included into the project. Only because of that the wizard did not work.

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

2 Comments

This could also happen when leftovers in the database explorer are not updated. Could be solved by going to the database explorer window and deleting all previous data connections.
Ran into the same issue as the OP, and just by deleting out my DB servder connections I was able to make a new connection and finish out the entity data model wizard normally. Thanks for the hint.
0

I had this problem too, all the above didn't work for me. What helped for me was the following.

When you try to connect with a database that database can have different users with different credentials it can accept. Let's say user A till D.

If you try to connect with a user make sure that user has the right credentials enabled, in this case, read and write options enabled.

To do this start MS SQL Server Managment Studio, connected with your SQL server and select the database you try to make a connection with in visual studio. Under 'your_dbname' --> Security --> Users you find a list of users. Rightclick the username you try to login with and select properties. A window opens. Select the 'General' (selected by default) page and under tab 'Database role membership' make sure 'db_datareader' and 'db_datawrite' are selected.

Note: When you log in too MS SQL Server Managment Studio make sure you log in with a user which can enable/disable these options...

Comments

0

I created an empty model, then selected it in 'Model browser', right clicked on it and selected 'Update model from database'. Then I was able to add a table to it...

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.