Null Binary Field

I have a photo field (image) in MSDE. Some records have photos, others have null. If it is null, I want to exit sub.

If IsNothing(dtTry.Rows(lstPhotos.SelectedIndex)("photo")) Then Exit Sub

But the problem is that the above VB 2003 code always returns False even for records with photo being null . How can I modify it to return True for records with null photo




Answer this question

Null Binary Field

  • xxpor

    Great! Works like charm.

  • MachAngle

    AtinLango wrote:

    I have a photo field (image) in MSDE. Some records have photos, others have null. If it is null, I want to exit sub.

    If IsNothing(dtTry.Rows(lstPhotos.SelectedIndex)("photo")) Then Exit Sub

    But the problem is that the above VB 2003 code always returns False even for records with photo being null . How can I modify it to return True for records with null photo

    Have you tried IsDBNull

    --------------------------------------------------------------------------------------

    If IsDBNull(dtTry.Rows(lstPhotos.SelectedIndex)("photo")) Then Exit Sub

    DBnull is not the same as Nothing and is also not the same as zero-length string ("")


  • Null Binary Field