« It doesn't get much better than this | Main | Great library of stock business images »

December 23, 2005

Column not showing up in Table Adapter

I'm really loving the new Table Adapters in Visual Studio 2005. They've eliminated any need I have for coding up a data access layer, or using things like the Data Access Application Block, for a number of stand-alone apps that I'm working on. But I did get bit by a simple issue the other day. I had a database, and it contained a column named "Step". When I generated a Table Adapter for this, the Step column was not showing up in the resulting typed data table. This made sense, because Step is a reserved word in VB.NET (one would assume that you'd have the same problem in C# with a column named "using", for example.) I was about to file a ladybug, when I decided to go back and dig a little deeper. Some little voice in the back of my mind was trying to remind me of something, but what?

It turns out that in these cases, the column name in the data table will be prefixed with an _. So accessing the column becomes MyTable._Step. Time to up the dosage of Ginko Biloba, I guess. I'd run into this same issue years ago, and completely forgot about this behavior on Typed Datasets.

Posted on December 23, 2005 at 09:48 PM | Permalink


The comments to this entry are closed.