473,471 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to databind results of LINQ query from ADO.Net Entity Framework with DataGrid

1 New Member
Hi.
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
  1. from d in App.glidusContext.tbl_users
  2. select new { d.userID, d.userName, d.userPassword }
  3.  
My DataGrid code:
Expand|Select|Wrap|Line Numbers
  1. <DataGrid x:Name="ContentDataGrid">
  2.    <DataGrid.Columns>
  3.       <DataGridTextColumn Header="User ID" />
  4.       <DataGridTextColumn Header="User Name" />
  5.       <DataGridTextColumn Header="Password" />
  6.    </DataGrid.Columns>
  7. </DataGrid>
  8.  
As I understand I have to use DataBinding mechanism and set DataContext, ItemSource, Mode etc.

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.
Oct 9 '10 #1
0 1277

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: TOMERDR | last post by:
Hi, I have Visual studio.NET 2005 on XP proffessional Is it possible to me to use LINQ and ADO.NET Entity Framework? Can LINQ and ADO.NET Entity Framework be used with express editions as...
0
by: Fakher Halim | last post by:
Does someone know any place to get working examples of inherence implemented in Entity Framework using Visual Studio 2008 SP1. I could only implement just one table per hierarchy (...
0
by: Andy B | last post by:
I wanted to try out the ado.net entity framework model and see how it was different from linq to sql entities. I put a page in a web application project, added an ado.net entity model and told it...
9
by: Cirene | last post by:
I'm about to begin a brand new, big, ASP.NET project (using 3.5 .net fw), VS 2008. I'm using MySQL as the backend (customer request.) I have absolutely no experience with LINQ and/or the Entity...
3
by: chris.kennedy | last post by:
I am really struggling to create an entity which maps to 2 "base" entities. I have a customer and invoice entity which are based in tables in a one to many relationship. I have tried: 1....
1
by: markla | last post by:
Hi, I have an Entity data model built in Entity Framework, which sources data primarily from an MS SQL 2008 database, and sources some static (data dictionary) values from code-based objects. I...
1
by: Andy B | last post by:
I have to learn how to do one or the other: linq to sql or ado.net entity framework. There will be overhead no matter what way I go since I don't know either one. Which one would be the best one to...
0
by: muratto | last post by:
Hello, I'm trying to build a 3 tier architecture with Ado.NET Entity Framework. I want to select only paged records from Database. But I can't find a solution to make dynamic with Linq to...
2
by: scott1010 | last post by:
Hello I am having problems with a Linq query. I need to return an ID field which is of type GUID (c.Id) along with other fields of type String. I have tried both anonymous types and strongly typed...
0
by: James Folkerman | last post by:
Hi. 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.