My insert in two tables is a success but I am getting error on Index action to display the data.
Model and View Models.
View Models
public class VMUsers
{
public int Id { get; set; }
public string FullName { get; set; }
public string LastName { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
}
Models
[Table("tblUsers")]
public class Users
{
[Key]
public int Id { get; set; }
public string FullName { get; set; }
public string LastName { get; set; }
}
[Table("tblUserDetails")]
public class UserDetails
{
[Key]
public int Id { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public int UserID { get; set; }
}
DBSet
public System.Data.Entity.DbSet<MVCLearning.Models.VMUsers> Combination { get; set; }
Index Action
public ActionResult Index()
{
return View(db.Combination.ToList());
}
Getting exception
An exception of type 'System.Data.Entity.Core.EntityCommandExecutionException' occurred in EntityFramework.SqlServer.dll but was not handled in user code
Additional information: An error occurred while executing the command definition. See the inner exception for details.
Cant understand what is this inner excepton.
It breaks so the debug part to see the error also breaks it doesn't goes to the View for debugging.