Checking for Empty Dataset -- Simple Question

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Checking for Empty Dataset -- Simple Question

    Can anyone tell me how to check and see if a dataset is empty?

    I am writing a search function that returns a dataset and binds it to a
    datagrid. If no data is found, I would like to make the grid invisible and
    have a label appear stating that no data was found.

    Any suggestions?

    Thanks,

    Ron Rodenberg


    Ron Guest

  2. Similar Questions and Discussions

    1. Need Simple Answer to Simple Contribute/Firefox question
      Hello all; I've tried the Adobe help in CS3, tech support, phone support, this forum, other forums, Mozilla, and nowhere can I get a straight...
    2. Detailsview empty dataset insert
      My details view is in insert mode and my dataset is empty but the details view doesnt show. who can help me, how to do? Also I tried to set...
    3. Error checking - Empty and Null and 0
      Thanks this worked great... cfset math = Val(myvar) +1
    4. checking the return value of member function with empty
      I am having this rather annoying syntax problem. I have this.. if (!empty($this->GetParam('someparameter')) { // OK do something since the...
    5. dataset efficiency question
      Hi, If you have a page that accesses a few db tables, and utilizes all, or most of the data in different ways at different times, do you think it...
  3. #2

    Default Re: Checking for Empty Dataset -- Simple Question

    If MyDataSet.Tables.Count = 0 Then 'it's empty

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]



    "Ron" <ron@razorvision.net> wrote in message
    news:bekevp$1i5@library1.airnews.net...
    > Can anyone tell me how to check and see if a dataset is empty?
    >
    > I am writing a search function that returns a dataset and binds it to a
    > datagrid. If no data is found, I would like to make the grid invisible and
    > have a label appear stating that no data was found.
    >
    > Any suggestions?
    >
    > Thanks,
    >
    > Ron Rodenberg
    >
    >

    Steve C. Orr, MCSD Guest

  4. #3

    Default Re: Checking for Empty Dataset -- Simple Question

    Thanks a lot Gaston, I appreciate your help.


    "GastonQ" <gastonq_nospam@yahoo.com.ar> wrote in message
    news:04ba01c3471c$dca7d9b0$a101280a@phx.gbl...
    > Hi Ron, to check an empty DataSet you must verify the Rows
    > of the DataTable object that contains the database query
    > result.
    >
    > For example:
    > DataSet ds = new DataSet( "MyTable" );
    > ...
    > if( ds.Tables[ "MyTable" ].Rows.Count == 0 )
    > // No records
    > else
    > // Do something...
    >
    > Regards
    > Gaston Quirque
    > Microsoft MVP
    >
    > >-----Original Message-----
    > >Can anyone tell me how to check and see if a dataset is
    > empty?
    > >
    > >I am writing a search function that returns a dataset and
    > binds it to a
    > >datagrid. If no data is found, I would like to make the
    > grid invisible and
    > >have a label appear stating that no data was found.
    > >
    > >Any suggestions?
    > >
    > >Thanks,
    > >
    > >Ron Rodenberg
    > >
    > >
    > >.
    > >

    Ron Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139