A simple data Table with HTML

  • Thread starter Thread starter Des
  • Start date Start date
D

Des

I am trying to get to grips with .net database. I have frequently used
record sets with web pages in html. Using code like
While rs.eof = false
<td><%=rs("Name")%></td><td><%=rs("Address")%></td>
Rs.movenext

This was simple No I seem to have to write

<td><%tblProducts.Rows(0)("Quantity")%></td>

I know Rows(1) is the next record and I could have a variable here, but
is there no EOF and no MoveNext anymore. All the documentation in books
(Including Microsoft explain how great it is to use with the data
control. But if I don't use the data control I am up the creek
without a paddle. I have checked extensively for this information
including MSDN without success.


Desmond.
 
There is a hundred different choices, but you can iterate through the
DataRows of the Datatable using a foreach.

DataSet ds = new DataSet();
adapter.Fill(ds);

foreach(DataRow row in ds.Tables[0].Rows)
{
name = row["Name"];
address = row["Address"];
}

Have a read of this, its a very simple to follow example you could probably
fit your table code around.

http://msmvps.com/blogs/simpleman/archive/2005/06/24/54832.aspx
 
Des said:
I am trying to get to grips with .net database. I have frequently used
record sets with web pages in html. Using code like
While rs.eof = false
<td><%=rs("Name")%></td><td><%=rs("Address")%></td>
Rs.movenext

This was simple No I seem to have to write

<td><%tblProducts.Rows(0)("Quantity")%></td>

I know Rows(1) is the next record and I could have a variable here, but
is there no EOF and no MoveNext anymore. All the documentation in books
(Including Microsoft explain how great it is to use with the data
control. But if I don't use the data control I am up the creek
without a paddle. I have checked extensively for this information
including MSDN without success.


Desmond.

tblProducts.rows.count should give you the number of rows. So you could
put that in a for-next loop.
 
Back
Top