I’m trying to retrieve the raw SQL generated by Entity Framework for the following LINQ query: pagedItemResults = from firstItem in dbData.Accession join secondItem in …
Tag: linq
EF – AND NOT EXISTS (SELECT 1 …) with Entity Framework
I am trying to run this query using Entity Framework in my ASP.NET MVC project but I am not succeeding. Could anyone help me do this using LINQ? TABLES: Answer The direct equivalent LINQ construct of SQL NOT EXISTS (…) is !Any(…). So translates to
Why does orderBy in F# not result in an ORDER BY in SQL?
I’m currently working on a small project that uses USA county data. I have no problems ordering the data in a Seq.orderBy, but as there is a sortBy in the query expression I would expect the results to be sorted. This is not the case. Now, the above is what I’m executing, but my results end up looking like so:
linq to entities query which has multiple where clause and one where clause with where in condition
I’m trying to build a linq to entities query. This is what I have so far: from x in db.BusSchedule join y in db.BusSchedule on x.ID equals y.ID – 1 where Convert….
Link To Entities, how to fix Startswith resolving to sql CHARINDEX and ignoring index
I have the following model I’m calling this function The above is trying to reproduce the following sql However it’s generating the following nasty piece of work: As you can see, it’s generating CHARINDEX for the StartsWith. The problem is this is ignoring all the indexing I have setup, and takes many seconds to run on 5 million records. How
What is the best SQL statement to query a table using Excel 2010 VBA with ADO (or vb.net with LINQ)
Table Name: employees Right now I am stuck on trying to figure out how to combine two of my SQL queries into one. Query #1: SELECT * FROM `employees` WHERE `name` = ‘BOB’ …
Stored Procedure Return Type Can Not Be Detected
I am trying to drag this procedure over to the dbml in VS 2012 and I am getting the return type cannot be detected message. I have tried these: LINQ to SQL – Stored Procedure Return Type Error The …
Performance for using 2 where clauses in LINQ
In LINQ-to-Entities you can query entities by doing: I know that behind the scenes it will be translated to SQL to something similar to: However is there a difference (with respect to performance) if I write: Will it be translated to the same SQL query? From my understanding .Where() will return IEnumerable<T> so the second .Where() will filter the entities
LINQ to SQL, select from an inheritted class
Using LINQ to SQL and Object Relational Designing; Let’s say we have a class Animal with two inherited classes, named Cat and Dog. We can load the “Animal” class and its properties easily: However, when trying to load Cat or Dog, dataContext has the attribute of neither Cats nor Dogs. How is it possible to load a Cat or a
How to use the group join result to join another tables using LINQ?
I am not able to use the result of group join and then further applying the join with other tables. My SQL query is : and what I have done so far is: but now this result is not at all further used by me to create a join with other tables. I want to ask how to join further?