title: Matching primary key and foreign key value
body: <p>I need to match the value of column <code>[LESSONCAM_ID]</code> in both tables <code>TBL_LESSONCAM</code> and <code>TBL_VIDEO</code> as shown below.</p>
  
  <p><code>[LESSONCAM_ID] in TBL_LESSONCAM</code> is the <strong>Primary Key</strong></p>
  
  <p><code>[LESSONCAM_ID] in TBL_VIDEO</code> is the <strong>Foreign Key</strong></p>
  
  <hr>
  
  <pre><code>TBL_LESSONCAM
  ╔══════════════╦══════════╦════════════╦═══════════╗
  ║ LESSONCAM_ID ║ LESSONID ║    CAM     ║ VIDEOPATH ║
  ╠══════════════╬══════════╬════════════╬═══════════╣
  ║          100 ║       10 ║ Audience 1 ║ C://...   ║
  ║          101 ║       10 ║ Audience 2 ║ C://...   ║
  ║          102 ║       10 ║ Lecturer   ║ C://...   ║
  ╚══════════════╩══════════╩════════════╩═══════════╝
  </code></pre>
  
  <hr>
  
  <pre><code>TBL_VIDEO (BEFORE UPDATE)
  ╔═════════════╦══════════╦═══════════╦═════════╦════════════╦══════════════╗
  ║ ANALYSIS_ID ║ LESSONID ║ TIMESTAMP ║  VIDEO  ║ LESSONCAM  ║ LESSONCAM_ID ║
  ╠═════════════╬══════════╬═══════════╬═════════╬════════════╬══════════════╣
  ║           9 ║       10 ║       300 ║ C://... ║ Audience 1 ║ NULL         ║
  ║          10 ║       10 ║       600 ║ C://... ║ Audience 2 ║ NULL         ║
  ║          11 ║       10 ║       900 ║ C://... ║ Lecturer   ║ NULL         ║
  ╚═════════════╩══════════╩═══════════╩═════════╩════════════╩══════════════╝
  
  TBL_VIDEO (AFTER UPDATE)
  ╔═════════════╦══════════╦═══════════╦═════════╦════════════╦══════════════╗
  ║ ANALYSIS_ID ║ LESSONID ║ TIMESTAMP ║  VIDEO  ║ LESSONCAM  ║ LESSONCAM_ID ║
  ╠═════════════╬══════════╬═══════════╬═════════╬════════════╬══════════════╣
  ║           9 ║       10 ║       300 ║ C://... ║ Audience 1 ║ 100          ║
  ║          10 ║       10 ║       600 ║ C://... ║ Audience 2 ║ 101          ║
  ║          11 ║       10 ║       900 ║ C://... ║ Lecturer   ║ 102          ║
  ╚═════════════╩══════════╩═══════════╩═════════╩════════════╩══════════════╝
  </code></pre>
  
  <hr>
  
  <p>I have attempted the following update statement for <code>TBL_VIDEO</code> at the end of my code, but it won't update and still remain <code>NULL</code>:</p>
  
  <pre><code>using (SqlCommand cmd8 = new SqlCommand("UPDATE v SET v.LESSONCAM_ID=lc.LESSONCAM_ID FROM TBL_VIDEO v JOIN TBL_LESSONCAM lc ON v.LESSONCAM_ID=lc.LESSONCAM_ID; ", conn)) {
     using (SqlDataReader dr = cmd8.ExecuteReader()) {
     }
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated. Thank you!</p>