LINQ to Entities does not recognize the method 'System.DateTime ToDateTime(System.String)' method

前端 未结 4 496
再見小時候
再見小時候 2020-12-15 13:36

I am trying to convert one application to EntityFrameWork codefirst. My present code is

 string sFrom  =\"26/12/2013\";
 select * FROM Trans where  CONVERT(d         


        
4条回答
  •  攒了一身酷
    2020-12-15 14:11

    /i had a similar problem where i was getting a search string and querying a datetime column... see line 4/

    1)case "Admission_Date":
    2)if (!String.IsNullOrEmpty(SearchValue))
    3)   {
    4)   DateTime dtFrom = 
    Convert.ToDateTime(SearchValue); 
    wards = from s in db.CORE_DATA_tbl
        where s.Admit_Date == dtFrom
        orderby s.ActionType, s.AdmissionLocation
        select s;
        }
        break;
    

提交回复
热议问题