Hello
Today i have faced this error :
The 'phone' property on 'Student' could not be set to a 'System.String' value. You must set this property to a non-null value of type 'System.Int32'.
And my Model class is : Student[Table("tblStudent")]
public class Student
{
public int StudentId { get; set; }
public string name { get; set; }
public string email { get; set; }
public int phone { get; set; }
}
My Context class : StudentContext
public class StudentContext: DbContext
{
public DbSet Students { get;set; }
}
My StudentController is shown below :
public ActionResult Index(int id)
{
StudentContext stud = new StudentContext();
Student ss=stud.Students.Single(stu => stu.StudentId == id );
return View(ss);
}
Help me guys in that please soon

MayankPosted Dec 12, 2016, 9:22 AM
Manav PandyaPosted Dec 12, 2016, 9:19 AM
MayankPosted Dec 12, 2016, 9:16 AM
I have done the same without edmx.
It is working properly.
Issue is related to edmx only.
Please delete the table from the EDMX and re-add it.
Manav PandyaPosted Dec 12, 2016, 8:44 AM
MayankPosted Dec 12, 2016, 7:35 AM
If this resolve your issue then please mark as answer.
Salman BegPosted Dec 12, 2016, 5:24 AM
Fabio Silva LimaPosted Dec 12, 2016, 5:18 AM