In my old version of my project i have to used to retrieve records from SQL using the following SQL Query
where Convert(date,<DBCOLUMNNAME>,101) between Convert(date,<DATETIME VARIABLE>,101) and Convert(date,<DATETIME VARIABLE>,101)
Above SQL Query fetch records what we expect,
where Convert(date,FollowupDate,101) between Convert(date,'12/10/2012 12:00:00 AM',101) and Convert(date,'12/10/2012 12:00:00 AM',101)
The result will be,
Records with FollowupDate = '12/10/2012' (MM/dd/yyyy)
Now we are using linq ,
Here the same SQL is converted as
Quote: LeadDataContext ds = new LeadDataContext();
DateTime fd = DateTime.ParseExact("12/10/2012","MM/dd/yyyy",null);
var g = from a in ds.Leads
where a.FollowupDate >= fd.Date && a.FollowupDate <= fd.Date
But Its not retrieving the record while i search on particular date(12/10/2012)(both are same dates)
I have found in my DB, the FollowupDate is stored as '
but i need to check without timestamp hence i need to convert 'Followupdate' column without timestamp as like i did in above SQL query.
Even i checked with variable "fd" it retrieves "12/10/2012 12:00:00 AM" hence i tried to convert "fd" as "12/10/2012 00:00:00" but its not works..
Please help me out.. I'm newer to LINQ forgive me if i made some mistake in Syntax