ToString conversion in the C# LINQ query -


i having (most trivial problem) strings comparison in c#

i running linq query

var result = q in table              q.valuedate.tostring() == "12/11/2014 12:00:00 am"              select q; 

and empty response

however, when try

foreach (var in table) {     console.writeline(i.valuedate.tostring()); } 

i

12/11/2014 12:00:00 12/11/2014 12:00:00 12/11/2014 12:00:00 12/11/2014 12:00:00 

what doing wrong here?

i wouldn't sacrifice type safety of date converting string - possibly happening tostring() being converted *char type via cast / convert in db, results in different format. here's how it:

var checkdatetime = new datetime(2014, 11, 12); var result = q in table           q.valuedate == checkdatetime           select q; 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -