Enjoy Every Sandwich

Thoughts on SQL, XML, .NET and sometimes beer.

<July 2008>
SuMoTuWeThFrSa
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789


Navigation

Tools

List O'Links

Kent's Other Stuff

Subscriptions

News

Please read these
Notices and Disclamiers

Post Categories

Article Categories



Autoincrement Bytes.

I was happily coding up an example where I have a ADO.NET 1.x DataTable that's has an auto-incrementing field. Being the conservative type I am, I had coded the two fields to be of type Byte. When trying to create the ForeignKeyConstraint related to that column, I got an exception:

Property not accessible because 'Parent Columns and Child Columns don't have type-matching columns.'.

Sure enough, if you go check the DataType of the auto-incrementing column, its been "upgraded" to System.Int32. Silently. Nice. Now that you know the problem, the fix is easy. Make the columns Int32's. Ick.

Leason learned after 20 minutes of chasing that one down. Its going to be a grrrreeeaaat week.

posted on Monday, August 21, 2006 12:35 PM by ktegels





Powered by Dot Net Junkies, by Telligent Systems