Checking Data set wheather it contain data or not

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hellboss
    New Member
    • Jun 2007
    • 50

    #1

    Checking Data set wheather it contain data or not

    Hi !

    Iam using asp.net vs05 , After Filling the dataset by using some stored procedure ,I need to check the dataset ,wheather it has been fill with the desired data or not other wise is it empty or not, Kindly provide me with the solution code,
    Thanks in advance !!!
  • dip_developer
    Recognized Expert Contributor
    • Aug 2006
    • 648

    #2
    Originally posted by hellboss
    Hi !

    Iam using asp.net vs05 , After Filling the dataset by using some stored procedure ,I need to check the dataset ,wheather it has been fill with the desired data or not other wise is it empty or not, Kindly provide me with the solution code,
    Thanks in advance !!!
    just check the number of records for empty dataset.....wit h...
    ds.Tables[0].Rows.Count()

    [CODE=vbnet] Dim i As Integer
    i=ds.Tables[0].Rows.Count()
    If i= 0 Then
    ' do something
    Else
    'do something
    End If
    [/CODE]

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      don't forget to do a
      Code:
      if (ds.Tables.Count>0)
      {
      }
      Originally posted by dip_developer
      just check the number of records for empty dataset.....wit h...
      ds.Tables[0].Rows.Count()

      [CODE=vbnet] Dim i As Integer
      i=ds.Tables[0].Rows.Count()
      If i= 0 Then
      ' do something
      Else
      'do something
      End If
      [/CODE]

      Comment

      Working...