Display the contents of a Table from a Dataset

June 4, 2011 - 11:50

So you have already queried the database and obtained all the needed information which is contained in a database. This example will step through the rows in the table and display the values. I am assuming you already have a datatable in the dataset ds called "Results".

<%@ Import Namespace="System.Data.SqlClient,System.Data" %>

Dim prow as Datarow
For each prow in ds.Tables("Results").Rows
response.write(prow("Field1") & "<br>")
Next


This displays "Field1" for each of the rows in the data table, followed by a <br> to add a new line after each field displayed.



© 2011 simplevb.net