Groups | Blog | Home
all groups > dotnet faqs > november 2005 >

dotnet faqs : How to find dataset has values


Gomathi
11/15/2005 12:00:00 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

Mihir Solanki
11/15/2005 2:35:12 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

[quoted text, click to view]

Pathik H Rawal
11/15/2005 9:21:03 PM
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)


[quoted text, click to view]
Onawole, Clement Oladapo
1/7/2006 6:32:55 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

[quoted text, click to view]

AddThis Social Bookmark Button