How to handle assigning null field values from database without using variant, or is variant the best way?

  • From what im reading variant types are inefficient and should be avoided so I’m wondering if its possible to avoid them when handling database record values. I have custom objects that have populated properties from a database and am using variant type for all of them so that I can determine if the field is null (e.g. I have fields where the value could be 0 or a negative number so using 0 or negative numbers to indicate they are empty this does not work). Is there a way to do this so I’m using the data type (e.g. long) rather than variant or is variant the best way to do this?


  • Although it is true that using a Variant uses more memory than may be necessary in many cases, unless that is actually causing you a problem, I wouldn't worry too much about it. It's definitely the simplest option for what you are dealing with.

    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!