EDN Admin
Well-known member
I have the following linq to sql statement that I want to use in a C# 2008 application that connects to a sql server 2008 r2 database.<br/>
<br/>
var varGoodTransCount = (from t in rData.Trans<br/>
join iw in rData.Ibooks on t.Ibook_ID equals iw.Ibook_ID<br/>
join ip in rData.IPacks on iw.PID equals ip.PID<br/>
where ip.TNum == SPkgID
<br/>
group ip by ip.TNum into g<br/>
select new { TNum = g.Key, Frequency = g.Count() }).FirstOrDefault();
The line of code that has the problem is
If (varGoodTransCount.Frequency != null)
When I try to reference varGoodTransCount.Frequency, the error message says this is not an instance of an object.<br/>
Thus can you tell me what is wrong and how I can fix the problem?
View the full article
<br/>
var varGoodTransCount = (from t in rData.Trans<br/>
join iw in rData.Ibooks on t.Ibook_ID equals iw.Ibook_ID<br/>
join ip in rData.IPacks on iw.PID equals ip.PID<br/>
where ip.TNum == SPkgID
<br/>
group ip by ip.TNum into g<br/>
select new { TNum = g.Key, Frequency = g.Count() }).FirstOrDefault();
The line of code that has the problem is
If (varGoodTransCount.Frequency != null)
When I try to reference varGoodTransCount.Frequency, the error message says this is not an instance of an object.<br/>
Thus can you tell me what is wrong and how I can fix the problem?
View the full article