www.webdeveloper.com
Results 1 to 6 of 6

Thread: Check to see if dataset row is null

  1. #1
    Join Date
    Apr 2005
    Posts
    9

    Check to see if dataset row is null

    How can I check to see if a dataset row is null?

    Thanks in advance!!

  2. #2
    Example:
    Code:
    VB.NET
    If DataSet.Tables(0).Rows(0).Item("FieldName") Is DBNull.Value Then
    
    C#
    if (DataSet.Tables(0).Rows(0).Item["FieldName"] == DBNull.Value);

  3. #3
    Join Date
    Sep 2004
    Location
    Northeast, FL
    Posts
    332
    Or this slightly shorter version of the same.
    Code:
    If IsDbNull(DataSet.Tables(0).Rows(0).Item("FieldName")) Then

  4. #4
    Join Date
    May 2006
    Location
    Tampa, Florida
    Posts
    36
    hey thanks alot guys!!

  5. #5
    Join Date
    Mar 2013
    Posts
    3
    if the table does not have that particular data (number) then the following error comes
    There is no row at position 0

    how can it be rectified

  6. #6
    Join Date
    Oct 2013
    Posts
    1
    Hi, I am already checked in my program that dataset is empty or not but my site sometime gives the exception message that Dataset is empty if i am reset IIS after that this message will not occur until 4-5 hours.
    please provide appropriate solution to me.

    Quote Originally Posted by Memnoch View Post
    Example:
    Code:
    VB.NET
    If DataSet.Tables(0).Rows(0).Item("FieldName") Is DBNull.Value Then
    
    C#
    if (DataSet.Tables(0).Rows(0).Item["FieldName"] == DBNull.Value);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles