Sreekanth Reddy

Sreekanth Reddy

  • 352
  • 4.8k
  • 420.6k

Error on saveChanges() in MVC

Nov 21 2014 9:06 AM
I am doing insertion operation in MVC with Code first approach:
 
My Model class: 
public class RegUsers1
{
[key]
public int Uid { set; get; }
public string FullName { set; get; }
public string Email { set; get; }
public string Password { set; get; }
public string Gender { set; get; }
public string Qualification { set; get; }
}
 
In my controller:
[HttpPost]
public ActionResult Register(RegUsers u)
{
db.Users.Add(u);
db.SaveChanges();
return RedirectToAction("Home");
}
 
 
while inserting it is throwing an error as:
"An error occurred while updating the entries. See the inner exception for details. "
 
Please solve it friends. 

Answers (2)