How to find dataset has values

G

Gomathi

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
 
M

Mihir Solanki

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
 
G

Guest

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
 
O

Onawole, Clement Oladapo

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top