开发者

C# DataView RowFilter, null value for DateTime column

I'm trying to filter on null columns (I only want to show rows where the column is null), but the issue is I can't compare the column to 开发者_运维技巧a null, since the column is of DateTime value.

I get the following error

System.Data.EvaluateException: Cannot perform '=' operation on System.DateTime and System.String.

This is my code for the filter

CourseID IN (" + courseIds + ") AND Isnull(DateBooked, 'Null Column') = 'Null Column'

DateBooked is the column with DateTime value. Everything before the Isnull is functioning correctly. Help please!


Doesn't isnull always return a value of the same type as its first parameter?

Try DateBooked IS NULL instead of Isnull(DateBooked, 'Null Column') = 'Null Column'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜