Invalid object name 'dbo.Employees'.

Hi Experts

can't figure out why I have the error above. It occurs when I try to insert items in northwind db

the desinger.cs has this code

public partial class Employees : INotifyPropertyChanging, INotifyPropertyChanged
I also noticed that when I dragged across the employee table, it was called employee and not employees (northwind has it has this)

protected void butAdd_Click1(object sender, EventArgs e)
        string connectionString = ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ToString();
        DataClassesDataContext dataContext = new DataClassesDataContext(connectionString);

        Employees emp = new Employees();
        emp.LastName = txtLastName.Text;
        emp.FirstName = txtFirstName.Text;


Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

see if this post helps you

Thanks and regards,

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fernando SotoRetiredCommented:
Hi SirReadAlot;

If you open Server Explorer connection to the Northwind database and open the Table node what is the Employees table called? If it is the standard Microsoft Northwind it should be called Employees.

To find out what name it will be given in the model the file created by the ORM designer you need to look at the project options by Main Menu -> Tools -> Options... when the Options window opens click on the tree node Database Tools then O/R Designer and see what Pluralization is set to if set to True then Employees in the DB will become Employee in the model if set to False then Employees in the DB will become Employees in the model. From what you state I would expect that Pluralization is set to False.

What is Pluralization set to in your environment?
On what line of code does the error occur on?
Is this a compile error or Design error?

SirReadAlotAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.