Null Values in Access Database: How to handle

Discussion in 'Databases' started by Scott, Nov 7, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Try explicitly casting the database balue to string, i.e.,
    DateSold = Row.Item("DateSold").ToString
     
  2. I hope someone out there has a good suggestion. I have an access database with cells I want to display however some of the cells may have Null values or otherwise empty. I want these cells if empty to display as empty on my website that accesses the database. How do I test for a null value.

    Cast from type 'DBNull' to type 'Date' is not valid.

    &

    Cast from type 'DBNull' to type 'String' is not valid.

    on these lines

    DateSold = Row.Item("DateSold")
    Comments = Row.Item("Comments")

    How can I handle Null values from cells?
     
  3. Here is a function I use, normally for GetRows also:


    FUNCTION isNul( value )
    IF ISNull(value) or value = "" THEN
    isNul = ""
    ELSE
    isNul = value
    END IF
    END FUNCTION</CODE>





    then just call it like this:


    DateSold = isNul(Row.Item("DateSold"))
     
  4. Thank you this really helped.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page