HighTechTalks DotNet Forums  

How to find dataset has values

Dotnet FAQs microsoft.public.dotnet.faqs


Discuss How to find dataset has values in the Dotnet FAQs forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Gomathi
 
Posts: n/a

Default How to find dataset has values - 11-15-2005 , 04:33 AM






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



Reply With Quote
  #2  
Old   
Mihir Solanki
 
Posts: n/a

Default Re: How to find dataset has values - 11-15-2005 , 05:35 AM






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

Quote:
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



Reply With Quote
  #3  
Old   
Pathik H Rawal
 
Posts: n/a

Default RE: How to find dataset has values - 11-16-2005 , 12:21 AM



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:

Quote:
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




Reply With Quote
  #4  
Old   
Onawole, Clement Oladapo
 
Posts: n/a

Default Re: How to find dataset has values - 01-07-2006 , 12:32 PM



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" <PathikHRawal (AT) discussions (DOT) microsoft.com> wrote

Quote:
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






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.