devxlogo

Dealing With Null Values Returned From RDO Resultsets

Dealing With Null Values Returned From RDO Resultsets

If you’re assigning the values of columns you return from RDO queries into string variables, you’ll get an “Invalid use of Null” error if one of the columns has a Null value. For most purposes, I’d rather have the value as an empty string anyway. Rather than code for that each time I access a column, I’ve written a function called Clean that turns Null values into empty strings. I call it like this:

 strMyString=Clean(rdoResultset("MyVarCharColumn"))

I also convert Empty values as well, for use with Variants:

 Public Function Clean(ByVal varData As Variant) As StringIf IsNull(varData) Then	Clean = ""ElseIf IsEmpty(varData) Then	Clean = ""Else	Clean = CStr(varData)End IfEnd Function
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist