Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
AnswerRe: can't found provider sqlserver Pin
egenis2-May-12 2:03
egenis2-May-12 2:03 
Questionc# windows form & google api v3 Pin
mrx1002-May-12 0:39
mrx1002-May-12 0:39 
AnswerRe: c# windows form & google api v3 Pin
Richard MacCutchan2-May-12 2:42
mveRichard MacCutchan2-May-12 2:42 
GeneralRe: c# windows form & google api v3 Pin
mrx1002-May-12 4:38
mrx1002-May-12 4:38 
GeneralRe: c# windows form & google api v3 Pin
mrx1002-May-12 4:49
mrx1002-May-12 4:49 
AnswerRe: c# windows form & google api v3 Pin
loyal ginger2-May-12 9:21
loyal ginger2-May-12 9:21 
GeneralRe: c# windows form & google api v3 Pin
mrx1003-May-12 7:39
mrx1003-May-12 7:39 
GeneralRe: c# windows form & google api v3 Pin
loyal ginger3-May-12 15:51
loyal ginger3-May-12 15:51 
GeneralRe: c# windows form & google api v3 Pin
mrx1004-May-12 1:32
mrx1004-May-12 1:32 
GeneralRe: c# windows form & google api v3 Pin
loyal ginger4-May-12 2:32
loyal ginger4-May-12 2:32 
GeneralRe: c# windows form & google api v3 Pin
mrx1007-May-12 1:50
mrx1007-May-12 1:50 
QuestionNeed help in writing code on establish a PPTP (VPN Tunnel) connection in c#. Pin
kalyan_vb2-May-12 0:14
kalyan_vb2-May-12 0:14 
AnswerRe: Need help in writing code on establish a PPTP (VPN Tunnel) connection in c#. Pin
Richard MacCutchan2-May-12 2:41
mveRichard MacCutchan2-May-12 2:41 
QuestionRequesting for a snippet that can be used in LINQ to SQL query Pin
Nadia Monalisa1-May-12 20:48
Nadia Monalisa1-May-12 20:48 
Hi,

In my code, I am counting the number of records (sent emails) that are older than one month. In order to do that, I am using following snippet.

C#
int totalSentEmailsOlderThanMonth = emailSendingService.ListSentEmails().ToArray().Count(x => (DateTime.Now - x.SentDateTime).TotalDays > 30);


The reason I am using .ToArray() in my code as (DateTime.Now - x.SentDateTime).TotalDays cannot be translated in LINQ to SQL query so, by calling ToArray(), I am loading all records into the memory and then counting. But there are more than hundreds of records in my database and loading all the records into the memory just for counting is not efficient at all. So, would anyone please give me an alternative more efficient snippet that can be used in this scenario.

[[ By the way, emailSendingService.ListSentEmails() returns IQueryable<MyRecordType> ]]

Regards.
AnswerRe: Requesting for a snippet that can be used in LINQ to SQL query Pin
Keith Barrow2-May-12 2:23
professionalKeith Barrow2-May-12 2:23 
GeneralRe: Requesting for a snippet that can be used in LINQ to SQL query Pin
Nadia Monalisa2-May-12 4:32
Nadia Monalisa2-May-12 4:32 
QuestionSIFT Pin
ri19871-May-12 20:05
ri19871-May-12 20:05 
AnswerRe: SIFT Pin
AmbiguousName1-May-12 20:09
AmbiguousName1-May-12 20:09 
AnswerRe: SIFT Pin
egenis1-May-12 20:09
egenis1-May-12 20:09 
AnswerRe: SIFT Pin
Abhinav S1-May-12 20:27
Abhinav S1-May-12 20:27 
GeneralRe: SIFT Pin
ri19871-May-12 21:48
ri19871-May-12 21:48 
GeneralRe: SIFT Pin
ri19872-May-12 21:13
ri19872-May-12 21:13 
GeneralRe: SIFT Pin
ri19872-May-12 21:16
ri19872-May-12 21:16 
JokeRe: SIFT Pin
PIEBALDconsult2-May-12 11:05
mvePIEBALDconsult2-May-12 11:05 
GeneralRe: SIFT Pin
Pete O'Hanlon2-May-12 11:32
mvePete O'Hanlon2-May-12 11:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.