Movies CMS: Selecting an appropriate movie

So, the Movies CMS now looks like this. (To see a better view, click on it, or open it in another window).

The list of movies above are generated dynamically from the database.

The listings below are the letters from A to Z, followed by a “?”. The question mark is supposed to symbolize all movies that doesn't begin with A to Z, and lists those out.

So, I was using a DataSet in combination with a DataView to filter, like so:

daMovies.Fill(dsMovies, “Movies”);
dvMovies.RowFilter = FilterExpression;

where FilterExpression coerces the DataView, dvMovies to produce an interesting listings of movies.

FilterExpression reads like so: “Title LIKE 'A%'” when the letter “A” is selected, or “Title LIKE 'B%'” when the letter “B” is selected.

So, when “?” is selected, my initial RowFilter reads “Title LIKE '[^A-Z]%'”. What this expression means is that: Gimme all the movie titles that does not begin with the letter A..Z. Unfortunately, that didn't work. I was under the impression that RowFilter simply passes the FilterExpression on to the database backend, alas, that wasn't so. If that were the case, that expression would have worked, and I wouldn't be writing this entry now.

It appears that the FilterExpression is actually an interface implemented by other classes. For details, see “How to generate an SQL filter clause using C#”.

For now, the FilterExpression for “?” is left as blank, as I think out how to solve this interesting issue.

Comments

# re: Movies CMS: Selecting an appropriate movie

Friday, April 02, 2004 5:37 PM by chuacw

string _filter = string.Empty;
for(int i = 97; i < 123; i++)
{
_filter = _filter + " name not like '" + ((char)i).ToString() + "%' and";
}
_dv.RowFilter = _filter + " showinindex<>0";

# re: Movies CMS: Selecting an appropriate movie

Tuesday, April 06, 2004 11:41 PM by chuacw

Thanks for your tip.

What's showinindex? I can't find any reference to it.

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Enter the following code to ensure that your comment reaches the intended party:
Enter the numbers you see in the image: