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. columns don't currently have unique values

columns don't currently have unique values

Scheduled Pinned Locked Moved Visual Basic
helpdatabasesql-serversysadminquestion
3 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.
  • K Offline
    K Offline
    Kashar
    wrote on last edited by
    #1

    Hello, I am currentally having problems with the current line of code: .Relations.Add("FK_Salaries_Employees", _ .Tables("Employees").Columns("EmployeeID"), _ .Tables("Salaries").Columns("EmployeeID"), True) This program uses SQL server to draw its data from, but the following error occurs: An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll Additional information: These columns don't currently have unique values. Any futhur help on solving this error, or perhaps shed some more light on what this means? Thanks, Kashar

    L 1 Reply Last reply
    0
    • K Kashar

      Hello, I am currentally having problems with the current line of code: .Relations.Add("FK_Salaries_Employees", _ .Tables("Employees").Columns("EmployeeID"), _ .Tables("Salaries").Columns("EmployeeID"), True) This program uses SQL server to draw its data from, but the following error occurs: An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll Additional information: These columns don't currently have unique values. Any futhur help on solving this error, or perhaps shed some more light on what this means? Thanks, Kashar

      L Offline
      L Offline
      Leeland
      wrote on last edited by
      #2

      If you don't have unique values, then you can't create foreign keys. The purpose of a foreign key is to make sure that the 2 rows in each table can be lined up. To do this, one of the tables needs to have unique entries for the column name you listed.

      K 1 Reply Last reply
      0
      • L Leeland

        If you don't have unique values, then you can't create foreign keys. The purpose of a foreign key is to make sure that the 2 rows in each table can be lined up. To do this, one of the tables needs to have unique entries for the column name you listed.

        K Offline
        K Offline
        Kashar
        wrote on last edited by
        #3

        The values are unique, Table Employees: EmployeeID FirstName SurName DateOfBirth SecurityPhoto DateOfHire LastReview 1 Robin Johnson 6/19/1963 10:47:00 AM 5/3/2000 10:47:00 AM 3/9/2002 10:47:00 AM 2 Denise Samson 11/6/1972 10:47:00 AM 10/19/2002 10:47:00 AM 5/10/2001 10:47:00 AM 3 Jack Jones 2/22/1945 10:47:00 AM 4/16/1999 10:47:00 AM 3/15/2002 10:47:00 AM 4 John Doe 9/18/1986 10:47:00 AM 3/6/1998 10:47:00 AM 3/9/2002 10:47:00 AM 5 Linda Glucina 4/9/1944 10:47:00 AM 2/9/2000 10:47:00 AM 3/11/2002 10:47:00 AM 6 Laura Wright 2/7/1978 2/23/1999 4/13/2002 11:23:00 PM 7 Stephanie Glucina 5/16/1963 5/21/2001 4/12/2002 11:23:00 PM 8 Linda Anderson 12/10/1981 7/9/2000 4/13/2002 11:23:00 PM 9 Graham Brown 6/7/1945 8/11/1999 5/16/2001 11:23:00 PM 10 Suzanne Smith 11/2/1960 1/6/1998 3/14/2002 11:23:00 PM 11 David Allan 9/22/1973 11/21/1999 3/13/2002 11:23:00 PM Table Salaries: EmployeeID SalaryAppliedFrom SalaryLevel 2 1/25/2002 119896 3 1/17/2002 119792 4 1/1/2002 119584 5 11/30/2001 119168 6 9/27/2001 118336 7 5/22/2001 116672 8 9/8/2000 113344 9 4/15/1999 106688 10 6/25/1996 93376 11 11/16/1990 66752

        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