So i made a new asp .net mvc application and just I still get this error ,
when I run it then show error "Unable to find the requested .Net Framework Data Provider" and if entered id in url like "localhost/MVC_Demo/employee/Details/2" then it show error in ...Please tell me how to solve? EmployeeContext.cs file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
namespace MVC_Demo.Models
{
public class EmployeeContext : DbContext
{
public DbSet<Employee> Employee { get; set; }
}
}
EmployeeController.cs file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVC_Demo.Models;
namespace MVC_Demo.Controllers
{
public class EmployeeController : Controller
{
public ActionResult Details(int id)
{
EmployeeContext employeeContext = new EmployeeContext();
Employee employee = employeeContext.Employee.Single(emp => emp.ID == id);
return View(employee);
}
}
}
Web.config
<connectionStrings>
<add name="EmployeeContext" connectionString="Server=.; database=dbEmployees; Integrated Security=SSPI" providerName="System.Data.Client" />
</connectionStrings>
Employee.cs File
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;
namespace MVC_Demo.Models
{
[Table("Emp")]
public class Employee
{
public int ID { get; set; }
public string Name { get; set; }
public string Gender { get; set; }
public string City { get; set; }
public int Salary { get; set; }
}
}