gpt4 book ai didi

sqlite - CoolStorage字段不等于过滤器

转载 作者:行者123 更新时间:2023-12-03 17:55:08 25 4
gpt4 key购买 nike

我正在使用带有SQLite本地数据库的Windows Phone 7应用程序工作,但我对此有所保留。

我定义了几个类,每个类都有一个映射设置,我希望检索一些过滤列表。我发现了很多示例,这些示例如何检查相等的值,而对于不相等的检查则没有。

CSParameterCollection parameters = new CSParameterCollection();
parameters.Add("@CurrentDate", currentDate);
parameters.Add("@DirectionId", intVisszaut);
CSList<Trip> RouteTrips = Route.Trips.FilteredBy("Services.StartDate <= @CurrentDate and Services.EndDate >= @CurrentDate and Services." + DayOfWeek.ToString() + " = 1 and DirectionId = @DirectionId", parameters);


这个过滤器可以正常工作,但是当我用以下内容更新它时,它失败了:

(Services.CalendarDates.Date!= @CurrentDate和Services.CalendarDates.Date.ExceptionType!= 2)

CSParameterCollection parameters = new CSParameterCollection();
parameters.Add("@CurrentDate", currentDate);
parameters.Add("@DirectionId", intVisszaut);
CSList<Trip> RouteTrips = Route.Trips.FilteredBy("(Services.CalendarDates.Date != @CurrentDate and Services.CalendarDates.Date.ExceptionType != 2) and Services.StartDate <= @CurrentDate and Services.EndDate >= @CurrentDate and Services." + DayOfWeek.ToString() + " = 1 and DirectionId = @DirectionId", parameters);


错误代码为:Vici.CoolStorage.WP7.dll中发生类型为'System.InvalidCastException'的第一次机会异常

Services是OneToOne,Services.CalendarDates是OneToMany映射。我使用太多的过滤器值还是做错了什么?通过使用<>也不起作用。

最佳答案

什么是Services.CalendarDates.Date.ExceptionType-您确定可以将其与2等数字进行比较吗?

要进行调试:


尝试删除过滤器表达式的每个部分,以便确定导致失败的部分
尝试链接到CoolStorage源代码-然后您可以确切地看到失败的内容(尽管这可能在其堆栈中很深,并且可能会让人有点难以理解)

关于sqlite - CoolStorage字段不等于过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9541092/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com