C# DataSet

I have this experience in C# that although an object is not NULL, if it's an array or a string, it doesn't mean that the length is equivalent to 0. In C# NULL and 0 length are 2 different conditions and both have to be deal with.

Because of the above, I've tried to check on DataSet to see if the same would happened. I'm using Stored Procedure and Microsoft Practice Pattern Enterprise Library to get the DataSet. At first I thought that if there are no matching result, than the DataSet should be NULL instead. Then I have a hunch that might not be the case because of the experience that I mentioned above.

So I do a check by having the Stored Procedure to check for a result that does not return a matching result. My guess is that although it's empty result, the DataSet will still be instantiated/created by the method. The test result proves my guess, because the DataSet is created/instantiated, and it has a 0 row count. Note that it happens with the Enterprise Library, so I don't really know if this is the same with the System.Data module.

So, if we are going to use DataSet to hold the data retrieves from the Microsoft Practice
Enterprise Library, we will need to check for both NULL and row count to determine the finding. We can actually do only the row count, since the DataSet will always be NOT NULL, but it's my habit that I will check for both case.

Comments

Popular posts from this blog

Yahoo! Messenger voice call & video call disabled, why?

Sport's Injuries - Treatment for bruises

Web Development: Disable, Validate, & Enable Buttons