我一直試圖通過字段表達式傳遞2個日期,並且遇到錯誤。請在下面找到我的代碼:如何在字段表達式中傳遞2個日期值
FilterExpression="PreparedDate >= 'id={0}' and PreparedDate <= 'id2{0}'"
我想實現查詢:
select * from table where date between date1 and date2.
我與日期值2所控制。
例外:
[EvaluateException:無法上的System.DateTime和System.String執行 '> =' 操作] System.Data.BinaryNode.SetTypeMismatchError(的Int32運算,類型左,右型) 26
System.Data.BinaryNode.BinaryCompare(對象vLeft,對象vRight,StorageType與resultType,運算的Int32,CompareInfo比較器)2133
System.Data.BinaryNode.EvalBinaryOp(的Int32運算,ExpressionNode左,ExpressionNode對,DataRow行,DataRowVersion版本,Int32 [] recordNo S)11692
System.Data.BinaryNode.Eval(DataRow的行,的DataRowVersion版)+26
乘坐看看這篇文章:http://stackoverflow.com/questions/2237440/c-sharp-linq-where-date-between-2-dates –
確定它是'id = {0}'而不是'id1 {0}' ? –
什麼類型的錯誤,以及錯誤消息是什麼? – martijn