Creating LINQ to SQL for counting a parameter
Posted
by Matt
on Stack Overflow
See other posts from Stack Overflow
or by Matt
Published on 2010-04-30T15:49:51Z
Indexed on
2010/04/30
15:57 UTC
Read the original article
Hit count: 215
linq-to-sql
I'm trying to translate a sql query into LINQ to SQL. I keep getting an error "sequence operators not supported for type 'system.string'" If I take out the distinct count part, it works. Is it not because I'm using the GROUP BY?
SELECT COUNT(EpaValue) AS [Leak Count], Location, EpaValue AS [Leak Desc.] FROM ChartMes.dbo.RecourceActualEPA_Report WHERE (EpaName = N'LEAK1') AND (Timestamp) > '20100429030000' GROUP BY EpaValue, Location ORDER BY Location, [Leak Count] DESC
Dim temp = (From p In db2.RecourceActualEPA_Reports _ Where (p.Timestamp >= str1stShiftStart) And (p.Timestamp < str2ndShiftCutoff) _ And (p.EpaName = "Leak1") _ Select p.EpaName.Distinct.Count(), p.Location, p.EpaValue)
© Stack Overflow or respective owner