locked
handlling null RRS feed

  • Question

  • User-2083102135 posted

    Hi

    in the following line 

    txtEmail.Text = recset1.Item(
    "Email")

     error is

    Conversion from type 'DBNull' to type 'String' is not valid

    valu in the Email field is null

    how to handle it

    Thanks

    Thursday, May 29, 2008 7:48 PM

Answers

  • User-989915499 posted

    Hi Ther,

    You can validate the datareader value as follow:

    Dim s As String = IIf(dr.Item("email") Is DBNull.Value, "", dr.Item("email"))

    Hope it helps!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 29, 2008 9:39 PM