For whatever reasons, I’m about two years behind the curve here. But, well, these are the cards I was dealt, and these are the cards I will play.
I’m beginning a series of entries about all the new data access stuff that I’m finding in Visual Studio 2008 / .NET Framework 3.5. I’ll discuss them in the context of a Visual Studio 2005 / .NET 2.0 application I wrote which analyzes historical data about public companies so that I can make decisions about whether to buy stock in those companies. At the heart of this program is a library which parses an HTML page from MSN where I have an account to retrieve historical data. Because of copyrights and terms of use agreements, I won’t be distributing or documenting that part of the program.
I have a simple data model in this Visual Studio 2005 Windows application. I’ve already converted the SQL Server 2005 database to SQL Server 2008; that went smoothly.
Simply, there are just two tables. One has a record for each company I want to look at. The other has an entry for each month where I pull down historical values. The column names are from the book that was the inspiration for doing this:
I loaded up Visual C# 2008, and then opened the old Visual Studio 2005 solution, which consisted of seven projects:

The conversion seemed to go pretty smoothly. There were some minor warnings about relative paths being different for the backup projects when they got moved to a different folder. That’s fine.
Next, I tried to compile the application. This didn’t go so well. What used to be one of my tried-and-true staples of quick-and-dirty personal projects seems to have lost a little weight. The strongly-typed DataTables in my strongly-typed DataSet object were missing a method they used to have: Select(string expression).
- public EquityDataSet.CompanyHistoryRow[] GetHistoryRows()
- {
- return DataSet.CompanyHistory.Select("Ticker='" + Ticker + "'", "Year DESC, Month DESC") as EquityDataSet.CompanyHistoryRow[];
- }
Now, I know I should have been spending the last couple of years kicking around LINQ and the ADO.NET Entity Framework and so on, but I let my day job get a little ahead of me. No more excuses, it’s time to figure out how to take my existing code and make it all new and shiny again.
One of the first things I noticed is that the direct ancestor of my strongly typed CompanyHistoryDataTable class is no longer just a System.Data.DataTable class, but is now an instance from the new generic System.Data.TypedTableBase<CompanyHistoryRow>.
It puzzles me a little, because I can see that TypedTableBase<> is a kind of DataTable. So what happened to my Select method? Why did it disappear?
It pays to read more than just the first error in the Error List pane.
The type 'System.Data.TypedTableBase`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
These other errors indicate that I need to add references to an assembly that I’ve never used before: System.Data.DataSetExtensions. The conversion wizard automatically added it to the Data project, but failed to add it to any of the projects that depend on the Data project. I’m sure Bing would have turned up something, but it’s easy enough to fix.
A little cleanup of SQL Connection Strings, and voila, I have a running application, but it’s still in the ADO.NET 2.0 frame of mind.
Next steps: Looking at LINQ (not posted yet)