2
Answers

Error on saveChanges() in MVC

Srikanth Reddy

Srikanth Reddy

9y
761
1
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)