Invalid Column Name : SQL / ASP.NET

The-Elite

New Member
I'm having a hard time debugging a particular problem and have a couple questions. First, here is what's going on:I have a relatively simple table called \[code\]Employees\[/code\], which has a primary key / identity \[code\]Id\[/code\]. There is also a \[code\]Username\[/code\] column - which is a \[code\]GUID\[/code\] foreign key to my \[code\]aspnet_Users\[/code\] table used for membership. Finally, there is another foreign key \[code\]Team_Id\[/code\] which points to another table, \[code\]Teams\[/code\]. All I'm really trying to do is give a selected employee's Id and pass it to a method in the DAL which then finds the employee with the following statement: \[code\]var employee = entities.Employees.Where(emp => emp.Id == employeeId); \[/code\]Once the employee is retrieved, I want to use another value which is passed to the same method - the selected team's Id - to update the employee's \[code\]Team_Id\[/code\] value (which team they are assigned to), using the following: \[code\]employee.First().Team_Id = teamId;entities.SaveChanges(); \[/code\]I get the exception \[quote\] Invalid column name: {Name}\[/quote\]which doesn't make sense to me, because Employee doesn't have a name column. All of that said, my questions are:[*]Where could the mix up possibly be coming from? I've tried thinking up a way to step through the code, but it seems like the error is somewhere in the query itself so I'm not really sure how to trace the execution of the query itself. [*]Is it possible that it may have something to do with my generated Entities? I noticed that when I type \[code\]employee.First().\[/code\] \[code\]Name\[/code\] comes up in Intellisense. I'm really confused by that, since as I've mentioned there is no Name column in the employees table.
 
Back
Top