Linq help - Sql trace returns result, but datacontext returning null?

This is really good question. I had the same issue with Linq to SQL when selecting invoices in the date range. Some of them were not present in the object results while they were included in the generated SQL query result.

I had some serious trouble with it because some invoices were not exported to the accounting software What I did was to create stored procedure and everything worked perfectly fine I would really like to know the true solution for this and why it happened.

This is really good question. I had the same issue with Linq to SQL when selecting invoices in the date range. Some of them were not present in the object results while they were included in the generated SQL query result.

I had some serious trouble with it because some invoices were not exported to the accounting software. What I did was to create stored procedure and everything worked perfectly fine. I would really like to know the true solution for this and why it happened.

This was a weird error on my part. We are developing against multiple databases, and this was simply a connection string issue. AN oversight really.

– Hcabnettek Oct 24 '09 at 21:28 I am having this trouble all of a sudden, anyone ever get a real answer to this? – Slee May 11 '10 at 13:02 I didn't. I've dropped using L2S and now I'm perfectly happy with EF.

– kubal5003 May 11 '10 at 13:08.

Var adminCov = db. SearchAgg_AdminCovs.SingleOrDefault(l => l.AdminCovGuid. Equals(covSourceGuid)); I have run into some comparison equality issues with GUIDs in the past (usually in Unit Testing), but the same might apply here.

Using Single or SingleOrDefault is always risky if there could be zero or more than one record matching the criteria. SingleOrDefault will return null if there are no matches or more than one match (in your case it could be more than one since you say there is data). This should cause a "Single" to throw an exception, if you try that.As an alternative you could try to use FirstOrDefault to get the first match if there is at least one match.

It will return null when there are no matches.

I'm not sure, but I used have some headache about forget to set one, but not sure if it was select/update/insert or delete.

I had the same issue with Linq to SQL when selecting invoices in the date range. Some of them were not present in the object results while they were included in the generated SQL query result. I had some serious trouble with it because some invoices were not exported to the accounting software.

What I did was to create stored procedure and everything worked perfectly fine.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions