I have SQL Server database that is connected to my WPF desktop-based application via ADO.NET Entity Framework.
Now I need get content of one of the table via LINQ query and show it in DataGrid control. Also, I need to let user to edit or delete data from DataGrid and update my database according this change.
Here is a LINQ query:
Expand|Select|Wrap|Line Numbers
- from d in App.glidusContext.tbl_users
- select new { d.userID, d.userName, d.userPassword }
Expand|Select|Wrap|Line Numbers
- <DataGrid x:Name="ContentDataGrid">
- <DataGrid.Columns>
- <DataGridTextColumn Header="User ID" />
- <DataGridTextColumn Header="User Name" />
- <DataGridTextColumn Header="Password" />
- </DataGrid.Columns>
- </DataGrid>
I tried a lot of examples from the Internet but most of them don't show how to make it with LINQ query, as result my application fails with InvalidOperationException.
Please, help me with this functionality, this issue really confused me and stops my project.
Thanks.