I am working on a Windows Phone 7 application with an SQLite Local Database and I've stuck with it a bit.
I have several classes defined, each of them has a mapping set up and I wish to retrieve a list with some filterings. I have found many examples how to check for equal values but none for not-equal checks.
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);
This filter works without any problems, but when I update it with the following, it fails:
(Services.CalendarDates.Date != @CurrentDate and 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);
Error code is: A first chance exception of type 'System.InvalidCastException' occurred in Vici.CoolStorage.WP7.dll
Services is a OneToOne, Services.CalendarDates is a OneToMany mapping. Do I use too many filter values or I do something wrong? It doesn't work by using <> either.
What is Services.CalendarDates.Date.ExceptionType
- are you sure that can be compared to a numeric like 2?
To debug this: