1

I am following this tutorial

http://csharp-video-tutorials.blogspot.com/2013/05/part-8-data-access-in-mvc-using-entity.html

but I got this error upon completing

enter image description here

I tried to change this connection in the tutorial

<connectionStrings>
  <add name="EmployeeContext" 
        connectionString="server=.; database=MVCDemo; integrated security=SSPI"
        providerName="System.Data.SqlClient"/>
</connectionStrings>

to:

  <connectionStrings>
    <add name="EmployeeContext"
          connectionString="Data Source=RL-PC\INSTANCE1;Initial Catalog=MVCDemo;Integrated Security=True"
          providerName="System.Data.SqlClient"/>
  </connectionStrings>
tereško
  • 58,060
  • 25
  • 98
  • 150
Karlx Swanovski
  • 2,869
  • 9
  • 34
  • 67

3 Answers3

0

When testing this locally, change your connection string to the following:

<connectionStrings>
<add name="EmployeeContext"
      connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=MVCDemo;Integrated Security=True"
      providerName="System.Data.SqlClient"/>

if your instance is SQLEXPRESS, otherwise replace that with the appropriate instance. Hope this helps!

Jose
  • 1,130
  • 3
  • 15
  • 25
  • Are you getting the same error? If you have the full version of SQL and not SQLEXPRESS, put your instance name instead of SQLEXPRESS – Jose Dec 06 '13 at 18:32
0

Open SQL Management Studio then Goto

  • SECURITY-->LOGIN--> right click on--> RL-PC\RL
  • select -->PROPTERY
  • select USER MAPPING
  • CHECKED your project database then
  • CHECKED--> db owner
  • CHECKED--> db securityadmin
  • CHECKED--> public
  • Click Ok and Run your project .hope it will work.
Mati Ullah Zahir
  • 168
  • 1
  • 3
  • 13
-1

Open SQL Management Studio And When The Login Box Shows, Copy That Server Name And Paste It Instead Of

RL-PC\INSTANCE1
TheSarfaraz
  • 167
  • 8