Live Chat Icon For mobile
Live Chat Icon

How to loop through a Dataset to display all records

Platform: ASP.NET| Category: ADO.NET

VB.NET


’Fill Dataset
Dim dc As DataColumn
Dim dr As DataRow
For Each dr In ds.Tables(0).Rows
	For Each dc In ds.Tables(0).Columns
		Response.Write(dr(dc.ColumnName).ToString())
	Next
Next

C#


//Fill the DataSet
foreach  (DataRow dr in ds.Tables[0].Rows)
{
	foreach( DataColumn dc in ds.Tables[0].Columns)
	{
		Response.Write(dr[dc.ColumnName].ToString());
	}
}

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.