Results 1 to 3 of 3

Thread: Evaluate NULL Sql Output paramaters

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Location
    Texas
    Posts
    246

    Evaluate NULL Sql Output paramaters

    How do you evalute a null sql output paramater. I've tied several ways but can find one that works. I always get an error code of Conversion from type 'DBNull' to type 'String' is not valid.

    I've tried both IsDbNull and if the value = nothing - both return the same error.

    Can anyone help me figure this one out? It has to be something simple!
    Code:
    If IsDBNull(e.Command.Parameters("@JobCount")) Then
                Me.lblInternalJobCount.Text = 0
            Else
                Me.lblInternalJobCount.Text = e.Command.Parameters("@JobCount").Value
     End If
    'I have also tried checking for nothing and that doesn't work either

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Evaluate NULL Sql Output paramaters

    If IsDBNull(e.Command.Parameters("@JobCount")) Then
    The above code checks if the Parameter Object is DBNull

    It should check if the Parameter's Value is DBNull

    Code:
    If IsDBNull(e.Command.Parameters("@JobCount").Value) Then

  3. #3
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Evaluate NULL Sql Output paramaters

    Hey,

    Yip, as Bruce as said. Here is the documentation:

    http://msdn.microsoft.com/en-us/libr....isdbnull.aspx

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width