sqlite - CoolStorage 字段不等于过滤器

标签 sqlite windows-phone-7 coolstorage

我正在开发一个带有 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/

相关文章:

Django 转移到 PostgreSQL 无法导入固定装置,说明数据太长

python - sqlite查询中的对数函数?

python - 为什么 Sqlite 在我明明创建时告诉我不存在这样的列?

windows-phone-7 - EmailComposerTask - 如何检测电子邮件是否未发送?

c# - 在 Silverlight 中,如何将 ListBox 项目选择绑定(bind)到 Navigate 事件?

silverlight - 如何检查应用程序是否处于空闲状态?

xamarin.ios - Vici CoolStorage for MonoTouch 支持 UniqueIdentifier 键吗?

java - SQLite random() 行,但其中 1 行必须具有特定值?

angular - 模块/node_modules/angular2-cool-storage/index.d.ts 的元数据版本不匹配错误,找到版本 4,预期为 3,

c# - 将 Vici Cool Storage 与 monodroid 一起使用