Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 participate in relationship
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

5 Posts

Posted - 03/16/2013 :  10:46:03  Show Profile  Reply with Quote
I am trying to save to the database tables "Employee" and "Employee_languages" I am recieving this following error (upon saving?)
Entities in 'knowitCVdbEntities.EMPLOYEE_LANGUAGES' participate in
the 'FK_EMPLOYEE_LANGUAGES_EMPLOYEES' relationship. 0 related 'EMPLOYEES' were found.

1 'EMPLOYEES' is expected.

This is my method for saving

public void setEmployee(string fileName)

        var emp = new EMPLOYEE
                          firstname = TextBoxFirstName.Text,
                          lastname = TextBoxLastName.Text,
                          about = TextBoxAboutYou.Text,
                          phone = TextBoxPhone.Text,
                          position = TextBoxPosition.Text,
                          email = TextBoxEmail.Text,
                          username = TextBoxUsername.Text,
                          date_of_birth = TextBoxDateOfBirth.Text,
                          image = FileUploadPicture.FileName
        var emplanguages = new EMPLOYEE_LANGUAGES();
            emplanguages.language_name = ListBoxLanguages.Text;


        var db = new knowitCVdbEntities();

I was under the assumption that my code was correct, but there must be something wrong. What seems to be the issue here?

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 03/16/2013 :  21:41:56  Show Profile  Reply with Quote
Is there a foreign key relationship between EMPLOYEE_LANGUAGES and EMPLOYEE, or perhaps is there a link table that has EMPLOYEE ID and LANGUAGE ID? Look at the tables in the database using SSMS - that is the only way I can think of to figure out what is going on (and perhaps the simplest).
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000