fixed connectionStrings编译时错误?

时间:2015-08-07 05:18:39

标签: asp.net-mvc entity-framework

我遇到的问题是:

  

类型' System.ArgumentException'的例外情况发生在System.Data.dll中但未在用户代码中处理。   其他信息:不支持关键字:' lenovo'。

    public class EmployeeController : Controller
{
    //
    // GET: /Employee/


    public ActionResult index()
    {
        EmployeeContext employeecontext = new EmployeeContext();
        List <Employee> employee = employeecontext.Employees.ToList();


        return View(employee);
    }






    public ActionResult Details(int id)

    {
        EmployeeContext employeecontext = new EmployeeContext();
        Employee employee = employeecontext.Employees.Single(emp => emp.EmployeeId == id);


        return View(employee);
    }

}}
<connectionStrings>
<add name="EmployeeContext"
     connectionString="LENOVO=.; Database=ED; integrated security=true"
     providerName="System.Data.SqlClient"/>

1 个答案:

答案 0 :(得分:0)

您传递的字符串不是有效的数据库连接字符串,请将其更改为此字符串:

<add name="EmployeeContext"
     connectionString="Server=LENOVO; Database=ED; integrated security=true"
     providerName="System.Data.SqlClient""/>