Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Foreign Key Constraint Message

Foreign Key Constraint Message

Scheduled Pinned Locked Moved Visual Basic
visual-studio
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike Murphy
    wrote on last edited by
    #1

    Hi...Sorry to be a pest. Perhaps related to my earlier post, but I'm getting the following message when I preview the dataset in the IDE: ForeignKeyConstraint 'EmployeeComments' requires the child key values (115) to exist in the parent table. This doesn't make sense. The relationship seems easy enough. The primary key and foreign keys are the same as far as Interger (8), nulls not allowed. Any ideas. Thanks in advance, Mike

    A 1 Reply Last reply
    0
    • M Mike Murphy

      Hi...Sorry to be a pest. Perhaps related to my earlier post, but I'm getting the following message when I preview the dataset in the IDE: ForeignKeyConstraint 'EmployeeComments' requires the child key values (115) to exist in the parent table. This doesn't make sense. The relationship seems easy enough. The primary key and foreign keys are the same as far as Interger (8), nulls not allowed. Any ideas. Thanks in advance, Mike

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      Simple. You have two tables (Table1 and Table2). Table2 has records that relate to records in Table1. The only thing holding the relationship is the fact that the two tables share a common field: Table1: Table2: recID ID# of record recID ID# of record in table 1 Name Some name Info1 Some information related to table1 Address Some address Info2 Some information related to table1 Both tables share a recID field. But, Table2 can have multiple records with the the same recID from Table1, this is a 1-to-many relationship. One record in Table1 is related to Many records in Table2. The problem your running into is there is a recID in Table2 that doesn't exist in Table1. It's a record that doesn't have a relationship to any record in Table1. You can probably code a SELECT statement to find the 'orphaned' records in Table2 for you, but I don't know exactly how to do it.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups