1

I'm learning this tutorial: http://www.codeproject.com/Articles/986730/Learn-MVC-Project-in-days-Day

I have problem with day 3 in first step - Step 1 – Create Database. I don't know how do this.

UPDATE

Ok, I added this DB, this is the tree in SQL Server Object Explorer enter image description here I have an error:

An exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.dll but was not handled in user code

in return

public List<Employee> GetEmployees()
    {
        SalesERPDAL salesDal = new SalesERPDAL();
        return salesDal.Employees.ToList();
    }

This is my connectionString

<connectionStrings>
    <add connectionString="Data Source=(LocalDb);Initial Catalog=SalesERPDB;Integrated Security=True"
            name="SalesERPDAL"
            providerName="System.Data.SqlClient"/>
</connectionStrings>

I added DB in App_Data project folder

4
  • Visual Studio has a "Server Explorer" pane which can connect to a database. Conversely, the database itself should have some kind of tool for connecting and managing databases. (Such as SQL Server Management Studio.) Commented Aug 17, 2016 at 19:30
  • @David I updated the question Commented Aug 17, 2016 at 20:57
  • Try to add your SQL instance name to the datasource ("LocalDb\MSSQLLocalDB") Commented Aug 17, 2016 at 21:47
  • @Reinard Works! :) Commented Aug 17, 2016 at 21:55

1 Answer 1

1

Do you have installed SQL Server Management Studio? an easy way to create a database is using this tool.

Just connect to the local instance and you will see a folder named DataBases, then Right-click > New Database...a window will appear to name this database as you wish

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.