Help with the tables in VB 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alzaabi20xx
    New Member
    • Feb 2007
    • 5

    #1

    Help with the tables in VB 2005

    hello everyone
    i want a little help i made 2 table in the ms access (employee & evaluation) and i transfer it into the VB2005 and i set the primary key for both tables.


    [PHP]Employee Table
    ----------------------------------------------------------
    ID (PK) | Name | Salary
    ----------------------------------------------------------

    Evaluation Table
    ----------------------------------------------------------
    EmpID (FK) | Date (PK) | Comments
    ----------------------------------------------------------[/PHP]

    when i start the program i enter the data of course i want to write more than one comments in one employee but when i write more than one data in the evaluation table the first data goes to the employee no1 and the other data goes to the employee no2 and so on.
    but when i write the data i see EmpID show the ID of the employee i write on but after i do save it goes to the other Employee

    [PHP]Employee Table:
    ----------------------------------------------------------
    ID (PK) | Name | Salary
    ----------------------------------------------------------
    1 | aaaa | $1000
    2 | bbbb | $2500

    Evaluation Table:
    ----------------------------------------------------------
    EmpID (FK) | Date (FK) | Comments
    ----------------------------------------------------------
    1 | 15/05/2007 | Good........... .....First Data
    1 | 16/05/2007 | Bad............ ......Second Data[/PHP]

    the (First data & the second Data) should goes to the first Employee but the First Data Goes to the First Employee & Second Data goes to the second employee and if i write a third it goes to the third one.

    so i don't know what's the problem & i wish to help me with this.....
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Originally posted by alzaabi20xx
    hello everyone
    i want a little help i made 2 table in the ms access (employee & evaluation) and i transfer it into the VB2005 and i set the primary key for both tables.


    [PHP]Employee Table
    ----------------------------------------------------------
    ID (PK) | Name | Salary
    ----------------------------------------------------------

    Evaluation Table
    ----------------------------------------------------------
    EmpID (FK) | Date (PK) | Comments
    ----------------------------------------------------------[/PHP]

    when i start the program i enter the data of course i want to write more than one comments in one employee but when i write more than one data in the evaluation table the first data goes to the employee no1 and the other data goes to the employee no2 and so on.
    but when i write the data i see EmpID show the ID of the employee i write on but after i do save it goes to the other Employee

    [PHP]Employee Table:
    ----------------------------------------------------------
    ID (PK) | Name | Salary
    ----------------------------------------------------------
    1 | aaaa | $1000
    2 | bbbb | $2500

    Evaluation Table:
    ----------------------------------------------------------
    EmpID (FK) | Date (FK) | Comments
    ----------------------------------------------------------
    1 | 15/05/2007 | Good........... .....First Data
    1 | 16/05/2007 | Bad............ ......Second Data[/PHP]

    the (First data & the second Data) should goes to the first Employee but the First Data Goes to the First Employee & Second Data goes to the second employee and if i write a third it goes to the third one.

    so i don't know what's the problem & i wish to help me with this.....
    Interesting. You have Data as a primary key in the first example and a foreign key in the second example. As the word Date is a reserved word it is better to give this column a different name.

    The example you have given shows the EmpID in your evaluation table to be correct in that it refers to employee number 1 in both cases.

    Comment

    Working...