Re: Testing datareader for System.DBNull (VB)

Discussion in 'ASP .Net' started by yoramo, Feb 6, 2004.

  1. yoramo

    yoramo Guest

    in C# you write:
    if (dr.IsNull("someField"))

    I guess that VB has the same method.

    yoramo.

    "Troy" <> wrote in message
    news:...
    > Using a simple select statement, how do you test for a null value from a

    datareader field?
    >
    > For example, I've tried:
    >
    > If drCIs Nothing Then
    >
    > ...
    >
    > End If
    >
    > And I've tried:
    >
    > Dim NULL As System.DBNull
    > If dr("someField") Is NULL Then
    >
    > ...
    >
    > End If
    >
    >
    > Thanks for the help.
    >
    > T
     
    yoramo, Feb 6, 2004
    #1
    1. Advertising

  2. > I guess that VB has the same method.

    Considering that it's the same class in VB, I would guess so too!

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "yoramo" <yoramo@[NOSPAM]hotmail.com> wrote in message
    news:#...
    > in C# you write:
    > if (dr.IsNull("someField"))
    >
    > I guess that VB has the same method.
    >
    > yoramo.
    >
    > "Troy" <> wrote in message
    > news:...
    > > Using a simple select statement, how do you test for a null value from a

    > datareader field?
    > >
    > > For example, I've tried:
    > >
    > > If drCIs Nothing Then
    > >
    > > ...
    > >
    > > End If
    > >
    > > And I've tried:
    > >
    > > Dim NULL As System.DBNull
    > > If dr("someField") Is NULL Then
    > >
    > > ...
    > >
    > > End If
    > >
    > >
    > > Thanks for the help.
    > >
    > > T

    >
    >
     
    Kevin Spencer, Feb 6, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ravikanth[MVP]
    Replies:
    6
    Views:
    3,927
    Aemca
    Jul 18, 2003
  2. Boris Zakharin

    Adding a DBNull value to the database

    Boris Zakharin, Aug 27, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    403
    Boris Zakharin
    Aug 27, 2003
  3. dave
    Replies:
    1
    Views:
    2,939
    Teemu Keiski
    Nov 26, 2003
  4. Elmo Watson
    Replies:
    3
    Views:
    6,083
    Scott M.
    Dec 25, 2003
  5. =?Utf-8?B?S2VpdGggQ2hhZHdpY2s=?=

    Loose typeing in class properties to system.dbnull help!

    =?Utf-8?B?S2VpdGggQ2hhZHdpY2s=?=, Jun 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    468
    =?Utf-8?B?S2VpdGggQ2hhZHdpY2s=?=
    Jun 7, 2005
Loading...

Share This Page