EntityType has no key defined error
Make sure public members of student class are defined as properties w/
{get; set;}
(yours are public variables - a common mistake).Place a
[Key]
annotation on top of your chosen property.
The Model class should be changed to :
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace MvcApplication1.Models
{
[Table("studentdetails")]
public class student
{
[Key]
public int RollNo { get; set; }
public string Name { get; set; }
public string Stream { get; set; }
public string Div { get; set; }
}
}