jdhackett
asked on
Check for null string in row
Hi
I'm looping through the columns in a row, and I need to find out if a column contains a null value. So I have code as follows:
Unfortunately, a null value will actually produce this message:
"Conversion from type 'DBNull' to type 'String' is not valid."
Is there a different way I could check for the null value in this case?
Thanks
I'm looping through the columns in a row, and I need to find out if a column contains a null value. So I have code as follows:
For iStage = 1 To MAX_STAGES
If Not String.IsNullOrEmpty(rowRenewal("User_" & iStage)) Then
Unfortunately, a null value will actually produce this message:
"Conversion from type 'DBNull' to type 'String' is not valid."
Is there a different way I could check for the null value in this case?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
For iStage = 1 To MAX_STAGES
If Not String.IsNullOrEmpty(rowRe
If it don't work try to detect the null value before assigning it to the string
For iStage = 1 To MAX_STAGES
If Not rowRenewal("User_" & iStage) = null then