Questions tagged [defaultifempty]

40 questions
0
votes
0 answers

LINQ: DefaultIfEmpty() causes slow response

I'm facing an issue where DefaultIfEmpty() causes slow response. The code is like: rslt = ( from p in P.Where(p => p.fcode == fCode && p.year == year && p.is_deleted == false && p.pname != pNameS) from c in C.Where(c => c.fcode == fCode &&…
Chanh Tran
  • 231
  • 2
  • 8
0
votes
1 answer

Entity Framework error using DefaultIfEmpty()

I have a problem with Entity Framework using the DefaultIfEmpty method. The following query is returning empty when it should return an offer that matches all criteria in the database. If I remove one or both DefaultIfEmpty method calls it works,…
tobi
  • 167
  • 1
  • 3
  • 12
0
votes
2 answers

Use DefaultIfEmpty to get default class values when using Union

I need to return a set of MyClass based on a tuple value list. This tuple values are used to get the correct object from database. In order to avoid calling db many times, I'm trying to use a Union to build the query and then get all the data from…
Alberto Montellano
  • 5,886
  • 7
  • 37
  • 53
0
votes
1 answer

DefaultIfEmpty returns empty rows

I've been trying to perform a Left Join kind of expression in LINQ to Entities, however the DefaultIfEmpty method works differently to what I expected - it returns an empty row for each CounterNo that doesn't have a match in the Readings table. var…
0
votes
3 answers

Excel 2010: Set cell value to same value as other cell, even if cell is empty

In Excel 2010, I want cell A1 to have the same value as cell A2. So I set a formula in A1: =B1 that works fine if B1 has a value. But, if B1 is empty, then A1 shows "0". I want A1 to be empty if B1 is empty. As a workaround, I'm using the following…
freesoft
  • 1,114
  • 3
  • 17
  • 26
0
votes
2 answers

Linq, Left Join and Dates

So my situation is that I have a linq-to-sql model that does not allow dates to be null in one of my tables. This is intended, because the database does not allow nulls in that field. My problem, is that when I try to write a Linq query with this…
Bitfiddler
  • 3,942
  • 7
  • 36
  • 51
0
votes
1 answer

Php script not importing new records as expected

I have made the following script to check if an article exists in another table, if it does it is supposed to echo that the article exists, if it doesnt it then adds the article id and article name to another table. The problem I am having is if I…
Iain Simpson
  • 8,011
  • 13
  • 47
  • 66
0
votes
2 answers

DefaultIfEmpty Linq to Sql returning null in Moles test

I made a moles in for testing my repository class and it works when I put DefaultIfEmpty(new Drivers()) but when I run the program, I get this error: Unsupported overload used for query operator 'DefaultIfEmpty'. But when I put it back to…
MilkTea027
  • 301
  • 1
  • 5
  • 24
-1
votes
1 answer

C# Linq DefaultIfEmpty LeftJoin

Some Agents has null in Group field. I'm trying to do LeftJoin, but receive result like InnerJoin (only Agents with not null Group) Agents = new ObservableCollection((await _repository.GetAgentsAsync() ?? new Agent[] { }) …
Vladimir
  • 13
  • 3
-3
votes
1 answer

DefaultIfEmpty Still Throwing Exception Sequence Contains No Matching Element

I have a method that looks like this: public static string MyMethod(string myParameter) { var defaultProperty = new Validation() {IDNumber = "ID Number Not Found", Logon = "ID Number Not Found" }; try { return…
Grizzly
  • 5,873
  • 8
  • 56
  • 109
1 2
3