I have the following code in a C# Visual Studio Web App:
SampleDataContext dbContext = new SampleDataContext();
gridView1.DataSource = from employee in dbContext.Employees
select employee;
This code works fine to display the table "Employee" in the SQL database "Sample".
I want to use similar code in a Windows Form App, using the DataGridView element instead of the GridView element:
SampleDataContext dbContext = new SampleDataContext();
dataGridView1.DataSource = from employee in dbContext.Employees
select employee;
This code mostly works but it also displays an extra column, I believe because the data has a foreign key. Every row reads "[Project Name].[Table that foreign key points to]" under the extra column named "[Table that foreign key points to]" How do I make it so that this column does not appear?
Do I have to load the table into a DataTable element and then use that as the DataSource for DataGridView element?