I would like to pull data from my server and add to a table object. Loop thru the data afterwhich I would like to display the results on the aspx page.
DataTable dTable = new DataTable();
dTable.Columns.Add("idNum", typeof(Int64));
dTable.Columns.Add("Name", typeof(String));
dTable.Columns.Add("Age", typeof(Int64));
//Connection/Command/Statement
DataReader dr = command.ExecuteReader();
while (dr.Read()) { /*Add data to rows*/ }
How do I add the data to the rows? What is the best way to display on aspx?
Try this code, I tested on my local: