Tagged Questions
4
votes
1answer
120 views
What's the better way to write this linq query?
SQL:
SELECT node.CategoryId,
node.CategoryName,
node.Description,
node.Lft, node.Rgt,
node.ShowOnMenu,
(COUNT(parent.CategoryName) - 1) AS Level,
(CASE WHEN node.Lft = ...
0
votes
3answers
33 views
how to avoid the member assignment in LINQ orderby/groupby
I have a query to return a count based on a condition
var query = (from a in this.db.Servers
where (a.Date >= fromDP.SelectedDate.Value && a.Date <= toDP.SelectedDate.Value)
...
0
votes
2answers
59 views
How to display the following result in WPF chart
In my WPF application, I have a following query to display the selected date range as 'Date' and total number of servers being processed on each day as 'Amount'.
var query_1 =
(this.db.Servers
...
0
votes
3answers
92 views
How to write the following query in LINQ
I have a sql query and would like to convert it into linq
SELECT CAST([Date] AS DATE),
COUNT([ID]) AS 'Amount of Systems'
FROM [DemoDB].[dbo].[Servers]
WHERE [ServerID] IN ('ServerX') AND [Type] ...
0
votes
2answers
67 views
How to convert SQL query to LINQ with Orderby, Groupby
I am writing to write this SQL query in linq, but didnt work..
select [ProcessTime], Count([ID]) as 'amount of processes'
from [DB].[dbo].[TableX]
where [ID] in ('ServerX', 'ServerY') and [Type] ...
0
votes
1answer
51 views
How to get only the date value from DateTime and count it?
How to compare only the date from the DateTime using LINQ to Entities and then sum it with another query.
I would like to achive the following
- to count the number of Type having the value ...
0
votes
1answer
87 views
Confusing MVC and LINQ to SQL
In this tutorial http://mstecharchitect.blogspot.com/2009/08/aspnet-mvc-and-linq-to-sql-using.html they recommend using LINQ to SQL in MVC. They then create a repository which basically makes it look ...
0
votes
1answer
24 views
How use LINQ to find entities where a list of sub entities contains another list
I have a complex object which contains 2 lists of more complex objects.
The first object is as follows:
public object1 {
public string Name { get; set; }
public virtual ...
0
votes
1answer
37 views
Need to turn LINQ Query from Normal JOIN into RIGHT OUTER JOIN
I have the following query:
var poll = entities.Polls.Join(entities.Descriptors, p => p.DescriptorID, q => q.ID, (p, q) => new
{
Poll = p,
...
0
votes
1answer
38 views
LINQ GroupBy to get Name and A Count
I'm a little confused on how to use a GroupBy in Linq. I need to display the name of a Product and Count it's offers, I've come up with this
var context = new Model.Entities();
var query = from p in ...
1
vote
1answer
136 views
LINQ using dictionary in where clause
er have the following query in linq...
Whenever I try to run it I get a No comparison operator for type System.Int[] exception.
It's got something to do with the dictionary I am sure, but I don't ...
2
votes
1answer
31 views
Select sub-sub-items of an object
being new to linq and Entity Framework this kind of puzzles me:
I created a model (of a tiny section) of my database through Entity Framework, with three tables in two straight-down 1:n relations: ...
1
vote
2answers
78 views
Display the lastest entry from Detail Table- using Linq to entities
I have a Datagrid as Master Table and a Pie-Chart for Detail's display.
I have a list of Servers with their ServerID's in the Master Table like this-
and my Details table is
I would like to ...
2
votes
1answer
72 views
Moving from SQL-query-based approach to Linq
I'm not so good at both Linq and SQL. But I have worked more with SQL and less with LINQ. I've gone through many articles which favors LINQ. I don't want to go the SQL way (i.e. writing stored ...
0
votes
3answers
222 views
Linq To Entities 'Only primitive types or enumeration types are supported' Error
I am using LinqPad to test my query. This query works when the LInqPad connection is to my database (LInq to SQL) but it does not work when I change the connection to use my Entity Framework 5 ...