I need to group a simple table but can't figure how to in linq.
The table has 3 columns. Fruit, Quantity, Quality. With
1st Row values being: Orange, 4, Good
2nd Row Values being: Apples, 2, Good
3nd Row Values being: Orange, 2, Bad
4nd Row Values being: Orange, 1, Good
5nd Row Values being: Mango, 1, Good
I need to be able to group by fruit,Quality so I get a result like this:
...
Search Result
Collapse
27 results in 0.0016 seconds.
Keywords
Members
Tags
-
How To Join Multiple Datatables Using LINQ To Dataset
Hi,
I have been searching for quite a while about joining multiple datatables via LINQ to dataset (When i say multiple, i don't mean just 2!!!), and it seems there aren't lot of examples in the net. I have seen examples of joining two datatables, done that, no problem there. Now i want to join three datatables. And there's nothing i can find out there.
For example i have a 3 datatables:
PERSON (columns:... -
sort alphanumeric values
Hi,
Does anyone know how to sort using linq-entity.
i use the following code:
from i in objEntities.Ite ms
where ....
orderby i.Name
select i
The result is item1,item2,ite m21, item22, item3. But, i want it to be like item1, item2, item3, item21, item22
Thanks -
LINQ to DataTable
hi,
I am trying to join two datatables using LINQ. I am unable to use .CopyToDataTabl e in my code. I have added System.Data.Dat aSetExtensions. dll. It gives me the error, 'CopyToDataTabl e' is not a member of 'System.Collect ions.Generic.IE numerable(Of <anonymous type>)'.
I have searched online a lot about this. The solution was to add the dll which I did but still I get the error.
Also there are... -
use a loop for LINQ result
Hi,
I am trying use LINQ t join two different tables. I have to loop through an array list to obtain the two data tables.
Currently I am using a for loop to go through the array list and then obtain the result for each data table. I have only one row in each data table for one value in array list.
I am using LINQ to join these two datatables. I am sending this LINQ join to a data set and... -
Error when using LINQ to dataset
Hi,
I am using LINQ to join two different datatables. I am trying to put the result in a dataset.
This code was working fine till yesterday. But today when I run the code, it gives me the error,
Unable to cast object of type '<JoinIterator> d__61`4[System.Data.Dat aRow,System.Dat a.DataRow,Syste m.Decimal,VB$An onymousType_0`1 0[System.Decimal, System.DateTime ,System.DateTim e,System.DateTi me,System.DateT ime,System.Deci mal,System.Deci mal,System.Stri ng,System.Strin g,System.String]]'... -
Error in LINQ join
HI there,
I am trying to join two datatables using LINQ.
...Code:Dim dt1 As New DataTable dt1.Load(dr1) Dim dt2 As New DataTable dt2.Load(dr2) Dim joinquery = From t1 In dt1.AsEnumerable(), t2 In dt2.AsEnumerable() _ Where (t1.Field(Of Long)("CLASS_N0") = _ t2.Field(Of Long)("CLASS_N0")) _ -
Neven Huynh started a topic How can i write query record in table have parentID with condition parentID == 0 andin C SharpHow can i write query record in table have parentID with condition parentID == 0 and
Hi Everyone,
Here i my LINQ query to get record in Table Menu with condition are parentID == 0(get root menu) and ID != (parentID list) (which is parent ID list is are id of menu record that have child), i just want to load all record includes root menu that have no children record and children record :
...Code:List<Menu> menus = MenuDAO.Instance.GetAll(); // Get All Record in Menu Table var parentID = (from p in
-
LINQ to SQL one to many query
Hello,
I have question about LINQ.
My scenario:
There is a database with a movie table and a shows table:
movie
number [PK]
name
show
show_number [PK]
movie_number [FK]
start_datetime
Now I only want to retrieve those movies that still have unstarted shows on the current day.
I dont know how to filter the movies based on the shows.
... -
Changing the database before every test (any other way to do it ?)
Hi, I am writing some profiling tests for certain methods like adding customers (different batch sizes 100, 1000, 10000) to customers table in the database. I am using SqlCE database because of its support from LINQ.
Now to reach the ideal case, i am changing the database before every test so that every test will have same database. for that i am using File.Copy() but while using db.customers.Fi rstOrDefault() in the second test, i... -
LINQ query from a list<> inside of a list<>
Hey everyone,
I've dealt with some simple LINQ queries before, but am not sure how to tackle this one...
I've got a project I'm working on where I'm dealing with two classes I've created, 'Package' and 'Product' (along with other classes).
I've also created a Job class which houses a List<Package> and inside the Package class it houses a List<Product>.
(NOTE): a Package is just... -
How to cycle through entries in Linq to SQL from query?
I have a small application using linq to sql to save entries into a database for name, email, phone, and birthday. I am able to save an entry and then call the first one back but if I have multiple entries with the same name for example, I don't know how to return one, prompt the user if its the one they want, and if not return the next one. My code for calling the first one looks like this:
...Code:do { -
Toucki started a topic How to databind results of LINQ query from ADO.Net Entity Framework with DataGridin .NETHow to databind results of LINQ query from ADO.Net Entity Framework with DataGrid
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:
...Code:from d in App.glidusContext.tbl_users select new { d.userID, -
how can i evaluate generic type in runtime in c#
i need to evaluate generic type at runtime usingCode:Type.GetType()
any ideas ?Code:Type t = Type.GetType("className"); Table<t> table = dataContext.GetTable<t>(); -
Query Over LINQ
First of all sorry if i put the question in wrong section... :)
In sql server the following code adds varchar values separated by a comma sign and you can see the output in the image attached... [I found the code somewhere on the web]
...Code:CREATE TABLE #YourTable ([ID] INT, [Name] CHAR(1)) INSERT INTO #YourTable ([ID],[Name]) VALUES (1,'A') INSERT INTO #YourTable ([ID],[Name]) VALUES (1,'B') INSERT INTO #YourTable