我正在使用SQLite本地数据库开发Windows 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”类型的第一次异常。
服务是OneToOne,Services.CalendarDates是OneToMany映射。我是使用了太多的筛选值还是做错了什么?使用<>也不能工作。
发布于 2012-03-04 14:14:11
Services.CalendarDates.Date.ExceptionType是什么?你确定它可以和像2这样的数字进行比较吗?
若要调试此选项,请执行以下操作:
。
发布于 2012-03-05 19:38:43
SQLite不理解!=语法。你应该使用<>
https://stackoverflow.com/questions/9541092
复制相似问题