Two or more columns act as one unique column

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lazyvlad
    New Member
    • Sep 2008
    • 5

    Two or more columns act as one unique column

    Hi people, I thought I had a simple problem ahead of me but it turns out it ain't that simple as I hoped it would be. So here is the problem:
    I've got a table in a dataset which acts like a join table to other parent tables making a many to many relation.
    Got two foreign keys in it which are related to their master tables, problems is I want to make the combination of the two foreign keys act like an unique entry.
    To be more precise, example:
    Table1: Employes, which contains every employee
    Table2: Months: which contains months of the year like id=number of month name=the name of the month
    Table3: the link between the two tables contains keys which relate to the id of the employee and the id of the month, my problem is I wanna restrict user from entering the same employee with the same month, t.i. an employee with id=1 and a month with id=1 can be written in Table3 only once. I thought i had some solution for this but my efforts failed.
    Thanks in advance
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Does this table exist on the database server, or only in your code?
    On the server you would just make a new unique key with the two columns.
    I imagine there is some type of similar functionality in the DataSets, although I don't know for sure.

    Comment

    • lazyvlad
      New Member
      • Sep 2008
      • 5

      #3
      Sorry for the late reply:(
      Yeah I am aware of the ability to make more columns act as a unique key in any relational database, that is why i was hoping this will be an easy task.What I really need is to make this sort of action in the dataset designer. I am not working with an actual database, I was trying to work in a disconnected mode all my tables are created in the xsd designer and I don't have a database connection. Was searching for this option, but I cant find it.
      Thanks again

      Comment

      Working...