This is my code . I am simply trying to select all students in my Students table ( which has 5 records, all visible in the Server Explorer )
var students = from p in schoolEntities.students
select p;
myGrid.DataContext = students.ToList();
This is my XAML for datagrid
<DataGrid ItemsSource="{Binding}" x:Name="myGrid /> // alignment etc left out
But this is what I am getting
I'm sure it is something trivial that I am leaving out above because binding the same DataGrid to , say a list of a class Person works fine, but using Linq for my database isn't working.
UPDATE: ( I hope below is clear) I just discovered that the Students table that has two columns Id and Name has a many to many relationship with Subjects table , which has id and SubjectName and there is a StudentsSubjects table with two columns StudentId, SubjectId which makes the many to many relationship work.
That is the cause of the problem. If I bind this datagrid to a simple Teacherstable it works because teachers table has no relationships.
Now I understand the problem, but I still don't know how to fix it :(
Thank you