How to find dataset has values

Discussion in 'ASP .Net' started by Gomathi, Nov 15, 2005.

  1. Gomathi

    Gomathi Guest

    hi all,

    In ASP.Net , i'm using a dataset. I want to find whether it has any values
    or not. How to do that?

    Thanks in advance.

    Regards,
    Gomathi
     
    Gomathi, Nov 15, 2005
    #1
    1. Advertising

  2. Hi

    here are some example of it. lets say your dataset name is "ds" then,

    ds.Tables.Count returns number of tables in dataset. ds.Tables[0].Rows.Count
    returns number of rows in first tables. ds.Tables[0].Rows[0][0] return value
    of first table's first row's first column.

    Mihir Solanki
    http://www.mihirsolanki.com

    > hi all,
    >
    > In ASP.Net , i'm using a dataset. I want to find whether it has any
    > values or not. How to do that?
    >
    > Thanks in advance.
    >
    > Regards,
    > Gomathi
     
    Mihir Solanki, Nov 15, 2005
    #2
    1. Advertising

  3. Hi Gomathi

    "ds" is the DATASET object

    U can use

    int tot_rec
    tot_rec=0

    if(ds.Tables.count>0)
    tot_rec= ds.Table[0].Rows.Count
    end if





    --
    Pathik H Rawal
    (DotNet Guy)


    "Gomathi" wrote:

    > hi all,
    >
    > In ASP.Net , i'm using a dataset. I want to find whether it has any values
    > or not. How to do that?
    >
    > Thanks in advance.
    >
    > Regards,
    > Gomathi
    >
    >
    >
     
    =?Utf-8?B?UGF0aGlrIEggUmF3YWw=?=, Nov 16, 2005
    #3
  4. U can also check if a column has values with

    if (ds.Tables[0].Rows[0][0] == DBNull.Value)

    That checks if the first column of table[0] first row has a value

    "Pathik H Rawal" <> wrote in message
    news:...
    > Hi Gomathi
    >
    > "ds" is the DATASET object
    >
    > U can use
    >
    > int tot_rec
    > tot_rec=0
    >
    > if(ds.Tables.count>0)
    > tot_rec= ds.Table[0].Rows.Count
    > end if
    >
    >
    >
    >
    >
    > --
    > Pathik H Rawal
    > (DotNet Guy)
    >
    >
    > "Gomathi" wrote:
    >
    >> hi all,
    >>
    >> In ASP.Net , i'm using a dataset. I want to find whether it has any
    >> values
    >> or not. How to do that?
    >>
    >> Thanks in advance.
    >>
    >> Regards,
    >> Gomathi
    >>
    >>
    >>
     
    Onawole, Clement Oladapo, Jan 7, 2006
    #4
    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. Gomathi

    How to find a dataset had values

    Gomathi, Nov 15, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    119
    Pathik H Rawal
    Nov 16, 2005
  2. Wybo Dekker
    Replies:
    1
    Views:
    363
    Yukihiro Matsumoto
    Nov 15, 2005
  3. vdvorkin
    Replies:
    0
    Views:
    412
    vdvorkin
    Feb 10, 2011
  4. vdvorkin
    Replies:
    3
    Views:
    813
    vdvorkin
    Feb 14, 2011
  5. Replies:
    0
    Views:
    113
Loading...

Share This Page