// generic method to display dataset contents into html table
public string html;
string displayData ( DataSet myData ) {
foreach ( DataTable table in myData.Tables ) {
// open the table
html += "<table cellspacing=1 class='data' width=92% style='font-size:10pt'>";
// set up table headers
// begin header row
html += "<tr>";
// loop thru each header column
foreach ( DataColumn col in table.Columns ) {
html += "<th>" + col.ColumnName + "</th>";
}
// end header row
html += "</tr>";
// loop thru the dataset
// first loop thru each row
foreach ( DataRow row in table.Rows ) {
html += "<tr>";
// loop thru each column
foreach ( DataColumn col in table.Columns ) {
html += "<td>" + row [ col ].ToString ( ) + "</td>";
}
// close each table row
html += "</tr>";
}
// close the table
html += "</table>";
}
// return string var
return html;
}