How to find the count of records in a dataset?

Answers were Sorted based on User's Feedback



How to find the count of records in a dataset?..

Answer / jeyaram thangaponnan

DataSet.Tables[0].Rows.Count will give the number of rows
in that table

Is This Answer Correct ?    30 Yes 0 No

How to find the count of records in a dataset?..

Answer / vaidyanathan r.

int count = 0
foreach(DataTable CurrTable in DataSet1.Tables)
Count += currTable.Rows.Count;

Is This Answer Correct ?    9 Yes 1 No

How to find the count of records in a dataset?..

Answer / eduardo belmonte

Regarding answer # 3 : It is correct.

Regarding answer # 2 : It is not correct, remember a
dataset contains datatables, and those datatables each can
have its own amount of datarows.

So to know "all" datarows in a dataset you have to add how
many rows "each" of its component datatables may have.

Is This Answer Correct ?    6 Yes 0 No

How to find the count of records in a dataset?..

Answer / jagadish

DS.Tables["tabname"].Rows.Count;

we can get count of the records.

Is This Answer Correct ?    6 Yes 2 No

How to find the count of records in a dataset?..

Answer / pushpendra singh

DataSet.Tables[0].rows.count returns total rows in table.

Is This Answer Correct ?    4 Yes 1 No

How to find the count of records in a dataset?..

Answer / guest

foreach(DataTable thisTable in myDataSet.Tables){
// For each row, print the values of each column.
foreach(DataRow myRow in thisTable.Rows)}

Is This Answer Correct ?    3 Yes 8 No

Post New Answer

More ADO.NET Interview Questions

What is difference between dataset and datatable?

0 Answers  


Which is the best institute in hyderabad to learn DotNet?

11 Answers   Cognizant,


How would you connect to database using .NET?

0 Answers  


Why do we need ado.net?

0 Answers  


What are the benefits of ADO.NET?

0 Answers   B-Ways TecnoSoft,






Explain the difference between data reader and data adapter?

0 Answers  


How to pass values into a datatable?

0 Answers  


Explain why edit is not possible in repeater?

0 Answers  


OleDbDataAdapter ole=new OleDbDataAdapter(new OleDbCommand ("select * from login",oleDbConnection1)); OleDbCommandBuilder cmd=new OleDbCommandBuilder(ole); ole.Fill(dataSet11,"login"); DataRow drow=dataSet11.Tables ["login"].NewRow(); drow[0]=textBox1.Text; drow[1]=textBox2.Text; drow[2]=textBox3.Text; dataSet11.Tables["login"].Rows.Add (drow); ole.UpdateCommand=cmd.GetUpdateCommand(); ole.Update(dataSet11,"login"); MessageBox.Show("one row added"); this gives exception.how to solve it

1 Answers   Nimaya,


What is the purpose of using adodb?

0 Answers  


What is a database provider?

2 Answers   BioSys,


How can we save all data from dataset?

0 Answers  


Categories