Null Values From Database

Discussion in 'ASP .Net' started by Randy Rubin, Aug 3, 2004.

  1. Randy Rubin

    Randy Rubin Guest

    How do I handle Testing for null values in a database? Here is a Line of
    Code:

    If Not jNull("JNum") Is DBNull Then

    And this is the Error:

    BC30684: 'DBNull' is a type and cannot be used as an expression.

    Thanks

    Randy
    Randy Rubin, Aug 3, 2004
    #1
    1. Advertising

  2. Randy Rubin

    Jos Guest

    "Randy Rubin" <> wrote in message
    news:%...
    > How do I handle Testing for null values in a database? Here is a Line of
    > Code:
    >
    > If Not jNull("JNum") Is DBNull Then
    >
    > And this is the Error:
    >
    > BC30684: 'DBNull' is a type and cannot be used as an expression.


    If ( TypeOf jNull("JNum") Is DBNull ) Then

    Jos
    Jos, Aug 3, 2004
    #2
    1. Advertising

  3. Randy Rubin

    Randy Rubin Guest

    This:

    If Not IsDBNull(jNull("JNum")) Then
    Seemed to work, But now I am getting:

    System.InvalidOperationException: Invalid attempt to read when no data is
    present

    I'm assuming this is because the value is Null... Anymore Ideas?


    "z. f." <> wrote in message
    news:%23$...
    > any problems with
    >
    > IsDBNull ( value )
    >
    > ?
    >
    >
    >
    > "Jos" <> wrote in message
    > news:%236h$...
    > > "Randy Rubin" <> wrote in message
    > > news:%...
    > > > How do I handle Testing for null values in a database? Here is a Line

    > of
    > > > Code:
    > > >
    > > > If Not jNull("JNum") Is DBNull Then
    > > >
    > > > And this is the Error:
    > > >
    > > > BC30684: 'DBNull' is a type and cannot be used as an expression.

    > >
    > > If ( TypeOf jNull("JNum") Is DBNull ) Then
    > >
    > > Jos
    > >
    > >

    >
    >
    Randy Rubin, Aug 3, 2004
    #3
  4. Just to give you a little bad news, none of these would work if your type of data is datetime - I am still looking for a solution for this!

    "Randy Rubin" wrote:

    > This:
    >
    > If Not IsDBNull(jNull("JNum")) Then
    > Seemed to work, But now I am getting:
    >
    > System.InvalidOperationException: Invalid attempt to read when no data is
    > present
    >
    > I'm assuming this is because the value is Null... Anymore Ideas?
    >
    >
    > "z. f." <> wrote in message
    > news:%23$...
    > > any problems with
    > >
    > > IsDBNull ( value )
    > >
    > > ?
    > >
    > >
    > >
    > > "Jos" <> wrote in message
    > > news:%236h$...
    > > > "Randy Rubin" <> wrote in message
    > > > news:%...
    > > > > How do I handle Testing for null values in a database? Here is a Line

    > > of
    > > > > Code:
    > > > >
    > > > > If Not jNull("JNum") Is DBNull Then
    > > > >
    > > > > And this is the Error:
    > > > >
    > > > > BC30684: 'DBNull' is a type and cannot be used as an expression.
    > > >
    > > > If ( TypeOf jNull("JNum") Is DBNull ) Then
    > > >
    > > > Jos
    > > >
    > > >

    > >
    > >

    >
    >
    >
    =?Utf-8?B?UmV6YSBTb2xvdWtp?=, Aug 3, 2004
    #4
  5. Randy Rubin

    z. f. Guest

    any problems with

    IsDBNull ( value )

    ?



    "Jos" <> wrote in message
    news:%236h$...
    > "Randy Rubin" <> wrote in message
    > news:%...
    > > How do I handle Testing for null values in a database? Here is a Line

    of
    > > Code:
    > >
    > > If Not jNull("JNum") Is DBNull Then
    > >
    > > And this is the Error:
    > >
    > > BC30684: 'DBNull' is a type and cannot be used as an expression.

    >
    > If ( TypeOf jNull("JNum") Is DBNull ) Then
    >
    > Jos
    >
    >
    z. f., Aug 3, 2004
    #5
  6. Randy Rubin

    Randy Rubin Guest

    Can someone post a code example that will check to see is the row or field
    is null?

    --Randy

    "Reza Solouki" <> wrote in message
    news:...
    > Just to give you a little bad news, none of these would work if your type

    of data is datetime - I am still looking for a solution for this!
    >
    > "Randy Rubin" wrote:
    >
    > > This:
    > >
    > > If Not IsDBNull(jNull("JNum")) Then
    > > Seemed to work, But now I am getting:
    > >
    > > System.InvalidOperationException: Invalid attempt to read when no data

    is
    > > present
    > >
    > > I'm assuming this is because the value is Null... Anymore Ideas?
    > >
    > >
    > > "z. f." <> wrote in message
    > > news:%23$...
    > > > any problems with
    > > >
    > > > IsDBNull ( value )
    > > >
    > > > ?
    > > >
    > > >
    > > >
    > > > "Jos" <> wrote in message
    > > > news:%236h$...
    > > > > "Randy Rubin" <> wrote in message
    > > > > news:%...
    > > > > > How do I handle Testing for null values in a database? Here is a

    Line
    > > > of
    > > > > > Code:
    > > > > >
    > > > > > If Not jNull("JNum") Is DBNull Then
    > > > > >
    > > > > > And this is the Error:
    > > > > >
    > > > > > BC30684: 'DBNull' is a type and cannot be used as an expression.
    > > > >
    > > > > If ( TypeOf jNull("JNum") Is DBNull ) Then
    > > > >
    > > > > Jos
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >
    > >
    Randy Rubin, Aug 4, 2004
    #6
  7. Randy Rubin

    Mark Whitton Guest

    This example is when using a data reader and checks if a field is null

    reader.IsDBNull(reader.GetOrdinal(fieldName))

    Mark Whitton

    "Randy Rubin" <> wrote in message
    news:mR4Qc.1765$aR2.346@okepread04...
    > Can someone post a code example that will check to see is the row or field
    > is null?
    >
    > --Randy
    >
    > "Reza Solouki" <> wrote in message
    > news:...
    > > Just to give you a little bad news, none of these would work if your

    type
    > of data is datetime - I am still looking for a solution for this!
    > >
    > > "Randy Rubin" wrote:
    > >
    > > > This:
    > > >
    > > > If Not IsDBNull(jNull("JNum")) Then
    > > > Seemed to work, But now I am getting:
    > > >
    > > > System.InvalidOperationException: Invalid attempt to read when no data

    > is
    > > > present
    > > >
    > > > I'm assuming this is because the value is Null... Anymore Ideas?
    > > >
    > > >
    > > > "z. f." <> wrote in message
    > > > news:%23$...
    > > > > any problems with
    > > > >
    > > > > IsDBNull ( value )
    > > > >
    > > > > ?
    > > > >
    > > > >
    > > > >
    > > > > "Jos" <> wrote in message
    > > > > news:%236h$...
    > > > > > "Randy Rubin" <> wrote in message
    > > > > > news:%...
    > > > > > > How do I handle Testing for null values in a database? Here is

    a
    > Line
    > > > > of
    > > > > > > Code:
    > > > > > >
    > > > > > > If Not jNull("JNum") Is DBNull Then
    > > > > > >
    > > > > > > And this is the Error:
    > > > > > >
    > > > > > > BC30684: 'DBNull' is a type and cannot be used as an expression.
    > > > > >
    > > > > > If ( TypeOf jNull("JNum") Is DBNull ) Then
    > > > > >
    > > > > > Jos
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > > >

    >
    >
    Mark Whitton, Aug 4, 2004
    #7
    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. Jimmy Crider
    Replies:
    3
    Views:
    448
    Chad Z. Hower aka Kudzu
    Feb 18, 2004
  2. Rookie Card
    Replies:
    1
    Views:
    1,483
    Daniel Fisher\(lennybacon\)
    Aug 5, 2005
  3. George G.

    Working with null database values

    George G., Aug 23, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    458
    Eliyahu Goldin
    Aug 23, 2005
  4. Replies:
    5
    Views:
    26,502
    Mike Schilling
    Mar 29, 2006
  5. Replies:
    0
    Views:
    399
Loading...

Share This Page