title: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_
body: <p>I have two tables , one to one relationship i makes DetailsID of projectDetails FK in ID of projects table:</p>
  
  <pre><code> projects: 
           ID,         //has FK With DetailsID in Details table &amp; auto identity (1,1)
           ProjectName,
           Areas,
           PaymentSystem,
           ReceivedDate,
           PropertyClassification,
           ProjectImage
  
    ProjectDetails:
       DetailsID ,auto identity ( 1,1)
       ProjectDetailName,
       ProjectDetailImage
  </code></pre>
  
  <p>I am trying to insert new record in projects table , gives me this error at this line of code  :</p>
  
  <pre><code>    con.Open();
      comm.ExecuteNonQuery(); // when execute
  </code></pre>
  
  <blockquote>
    <p>System.Data.SqlClient.SqlException: 'The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Projects_ProjectDetails". The conflict occurred in database "AlamaarRealEstate", table "dbo.ProjectDetails", column 'DetailsID'.</p>
  </blockquote>
  
  <p>and this is my stored to insert :</p>
  
  <pre><code>ALTER proc [Insert_Project]
     @Projectname                    NVARCHAR(MAX) , 
     @areas                          NVARCHAR(MAX) , 
     @Paymentsystem                  NVARCHAR(MAX) , 
     @Receiveddate                   date , 
     @Classification                 NVARCHAR(MAX) , 
     @Projectimage                   Nvarchar(MAX) 
    as
  
    INSERT INTO dbo.Projects
        (            
          ProjectName,
          Areas,
          PaymentSystem,
          ReceivedDate,
          PropertyClassification,
          ProjectImage                                                     
        ) 
   VALUES 
        ( 
          @Projectname ,
          @areas,
          @Paymentsystem ,
          @Receiveddate ,
          @Classification,
          @Projectimage          
  
        )
  </code></pre>