0

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.UserProfile_dbo.UserWork_UserWorkId". The conflict occurred in database "aspnet-UserAndWork-20130222085848", table "dbo.UserWork", column 'UserWorkId'. The statement has been terminated.

I run into the error message while loading the page Here are two of my tables classes

public class UserProfile
{
    [Key]
    public int UserId{get;set;}
    public string Username{get;set;}
    public int UserWorkId{get;set;}
    [foreignkey("UserWorkId")]
    public virtual UserWork UserWorkLog{get;set;}
}

public class UserWork
{
    [Key]
    public int UserWorkId{get;set;}
    public int UserId;
    //somemoire
}
Asp Asp
  • 864
  • 1
  • 7
  • 15

0 Answers0