DataTable objects can have different views applied to them. Suppose you had a column in your table called Age. Its very easy to preform local searches on this column:
dataTable.DefaultView.RowFilter = "Age < 75"; The RowFilter property implements a lot of sql style WHERE clauses including several "virtual" functions: http://tinyurl.com/2cvqh http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatacolumnclassexpressiontopic.asp Its also possible to create multiple views on the same table: DataView ageView = new DataView(dt); ageView.RowFilter = "Age < 75"; ageView.Sort = "LastName"; DataView heightView = new DataView(dt); heightView = "Height < 5 AND Height > 1"; ageView.Sort = "LastName"; And bind controls to each of the views. If you wanted to populate controls on a WebForm, you could first generate seperate views on the data then bind each list against the view: ddlAges.DataSource = ageView; ddlAges.DataTextField = "Name"; ddlAges.DataValueField = "UserId"; ddlAges.DataBind(); cblHeight.DataSource = heightView; cblHeight.DataTextField = "Height"; cblHeight.DataValueField = "UserId"; cblHeight.DataBind(); Its also possible to define strongly typed database structures complete with relationships using DataSets and DataTables. You can easily serialize the complete DataSet to a stream using WriteXml and ReadXml. In theory, you could run your application off of DataSets serialized to the drive acting like a virtual database. Strongly typed collections are severly lacking in all of the areas mentioned above. If I have a collection of users, there's no built-in way to say "find all users who have an Age less than 75". I believe its the IBindingList interface that makes DataViews so powerful. Apparently its extermely difficult to implement. A came across this class a few months ago that implements IBindingList and its worked out very well in terms of offering sorting and filtering capabilities to my collections. It was actually quite a bit faster in some areas than our customer CollectionBase that we had been using...the speed difference is now much smaller :) http://tinyurl.com/ao5p8 http://codebetter.com/blogs/brendan.tompkins/archive/2005/03/18/60065.aspx?CommentPosted=true#commentmessage UserCollection users = GetUsers(); CollectionView usersView = new CollectionView(users); usersView.ApplyFilter("Age",75,CollectionView.FilterOperand.LessThan); log.DebugFormat("Found [{0}] matching items.", usersView.Count); My post on codebetter.com shows how you can improve the code to allow multiple filters, more FilterOperands, and better handling of null values: usersView.ApplyFilter("Age",75,CollectionView.FilterOperand.LessThan); usersView.ApplyFilter("Name","Ro",CollectionView.FilterOperand.StartsWith); As I mentioned above, we implement collections based off of our own CollectionBase class that allows for more flexibility in terms of how the filter is defined: users = users.FindMany("Name", new RegexFilter("^Ro.$")); The develop who designed the base class subscribes to this list. I can forward any emails to him off list if anyone has an interest in seeing code for it. Nothing terribly ground-breaking I don't think. Just some nice convient ways to filter down the data. DataSets are often overlooked as being bloated but there aren't many alternatives when it comes to preforming complex local sorting and filtering. This looks very promising for .Net 2.0: http://www.wintellect.com/powercollections/ But for many of us that's not yet an option. Does Java have an elegant solution to these problems? - Ron --- Brandon Goodin <[EMAIL PROTECTED]> wrote: > Minor Rant: > > As a side note. After having toyed with DataSets... I am hard pressed > to see their value in the long run. It's like the EJB of the .NET > world. It's not neccesarily as complex... but it is certainly full of > just as much hot air.