Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MmType.IsEmpty
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01144991
Message ID:
01147423
Views:
21
Kevin,

This is a reference to a dataset created from a business object built by the business layer generator. In the business object, the field is defined as 'int' without the ? but the get statement returns a nullable value. In my statement -- if (!mmType.IsEmpty(pe.parish)) --, the pe is a reference to the entity object. Do I need to create a variable of type int? and test that rather than the dataset field value?

Thanks.

Linda


>I have an integer field that is a foreign key for another table. When I get a new dataset, I want to see if that field is not null and, if not, display the description from the foreign table. I tried using:
>if (!mmType.IsEmpty(pe.parish)) but when the field is null, I get an error "Object Reference is not set to an instance of an object" and when I put pe.parish in the watch window, it says "pe.parish threw an exception of type System.NullReferenceException. It is a nullable field and the business entity object identifies it as such. I assume I need to test for the value being null first but when I check to see if pe.parish == null, it says I can't use that with an integer.
>
>I also tried if (!mmType.Equals(pe.parish, null)) but didn't have any better luck.

Is your integer variable a nullable integer type? For example:


int? MyInteger;
Linda Harmes
HiBit Technologies, Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform