I have a database table called AllCustomersHistoryOfRecords which is table with history of all the records bought by all the users who visit my application/website. There is another table called Components which just enlists all the components available (for downloading) from my website. Now i want to count all the records available in AllCustomersHistoryOfRecords and update the count in field *Total_Downloads* of Components table. Here is what i'm doing to accomplish this:
Which is primarily counting the occurences of each record in AllCustomersHistoryOfRecords table.
var componentCount = from c in db.Components
join cr in db.AllCustomersHistoryOfRecords
on c.Component_Name equals cr.Software_Title into temporary
select temporary.Count();
And this is the code i'm using to insert the data into Components table:
Component comp = new Component { Total_Downloads = componentCount};
db.Components.InsertOnSubmit(comp);
But the problem is i'm getting the following error:
Cannot implicitly convert type 'System.Linq.IQueryable<int>' to 'int?'
How can i solve this problem ? Please Help me out!!
Thanks in anticipation