Monday, March 13, 2006

 

Typed Dataset data set in Visual Studio 2005 (VS.NET 2005) does not fully support nullvalue null value property as in previous release VS.NET 2003

http://lab.msdn.microsoft.com/productFeedback/viewFeedback.aspx?feedbackid=e5eb088e-c981-411c-bffd-66ab475319b7

If you are using typed data sets in visual studio 2003 you may be in a for a nasty surprise in visual studio 2005. If you use the "nullvalue" property on columns to supply a value when the data set contains a null, this property currently doesn't work right in Visual STudio 2005 (VS.NET 2005). The UI does not allow you to change "nullvalue" for any types other than string. FOr example, if you read data from the data base and store it in a dataset and you have a numeric column that is an optional foreign key to related information, you might specific nullvalue=0 in the typed data set. Let's say your column is named SomeValue. VS.NET 2003 generates this msprop:nullValue="0" attribute on the column.

You can code
SomeTable.SomeRow row = ds.SomeTable[index];
if (row.SomeValue > 0)
{
// optional info is present
}

without the nullvalue property, you would have to code
if (row.isSomeValueNull() && row.SomeValue > 0)
{
// optional info is present
}


This works because the typed data set actually generates the conditional statement internally. VS.NET 2005 continues to generate the same thing but the UI does not support setting the field. Just a little disconnect between what used to work and the next release.

To work aroundthis, you must edit the .XSD document to add the property. Again, VS.NET 2005 have made this substantially more difficult for no apparent reason. You used to be able to hit Ctrl+Page Down to switch into XML view but this no longer works.

Don't ask me why. I just work here.

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?