|
-
Jul 9th, 2008, 05:44 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [3.0/LINQ] Bindingsource.filter question
I've done some looking around and im a bit confused
Here is an example of the data thats in the binding source

what i want to do is sort on the 3rd row ( 4 or 3) and then sort by the date ( to see if the record is before a certian time
my idea to do this was to
filter the BS
bs.count
then unfilter the BS
The problem i keep running into is that i cant say that i want Just 4 or Just 3
What ive come up with so far is
c# Code:
private int deadlineCount(DateTime Time, int LeagueID)
{
int total = 0;
string league;
if (LeagueID == 99)
{
league = "";
}
else
{
league = LeagueID.ToString();
}
BS.Filter = string.Format("LeagueID >= '{0}' and LeagueID <= '{0}'and [End] <#12/30/1899 {1}#", league, Time.ToString("h:mm tt"));
total = BS.Count;
BS.Filter = "";
return total;
}
But i keep running into problems that i cant use any operator ( like ,> ,= ,>=,) becuase it can not preform X onn system.int32 and system.string.
I've been looking around but all the example seem to be for strings or dates.
-
Jul 10th, 2008, 12:02 AM
#2
Thread Starter
Fanatic Member
Re: [3.0/LINQ] Bindingsource.filter question
I found this post on the vb.net side
http://www.vbforums.com/showthread.p...+bindingsource
which lead me here
http://msdn.microsoft.com/en-us/libr...xpression.aspx
thats says i should be able to use
OPERATORS
Concatenation is allowed using Boolean AND, OR, and NOT operators. You can use parentheses to group clauses and force precedence. The AND operator has precedence over other operators. For example:
(LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'
When you create comparison expressions, the following operators are allowed:
<
>
<=
>=
<>
=
But when i try them i get the same error
I think im pretty stuck
any hints?
-
Jul 10th, 2008, 11:47 PM
#3
Thread Starter
Fanatic Member
Re: [3.0/LINQ] Bindingsource.filter question
I was able to bypass this by linking the leagueID feild to the table that assocates it with the acutall leage name ( nba rather than 3 and nfl rather than 4 so on)
and from there i was able to use a League LIKE 'string' and ........ to get what i need
-
Jul 12th, 2008, 08:42 AM
#4
Thread Starter
Fanatic Member
Re: [3.0/LINQ] Bindingsource.filter question
I figured this out already but is this something i could use LINQ for?
the filtering of the binding source seems to be a little slow and considering that i only want the count of the filter (all games that start after 7:00 that end before 9 and are NHL = 4 games)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|