A simple data Table with HTML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Des

    A simple data Table with HTML

    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("A ddress")%></td>
    Rs.movenext

    This was simple No I seem to have to write

    <td><%tblProduc ts.Rows(0)("Qua ntity")%></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.

  • John Timney \( MVP \)

    #2
    Re: A simple data Table with HTML

    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.



    --
    Regards

    John Timney
    Microsoft MVP

    "Des" <desotuatail@ao l.com> wrote in message
    news:1141034941 .255938.298630@ i39g2000cwa.goo glegroups.com.. .[color=blue]
    >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("A ddress")%></td>
    > Rs.movenext
    >
    > This was simple No I seem to have to write
    >
    > <td><%tblProduc ts.Rows(0)("Qua ntity")%></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.
    >[/color]


    Comment

    • C-Services Holland b.v.

      #3
      Re: A simple data Table with HTML

      Des wrote:[color=blue]
      > 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("A ddress")%></td>
      > Rs.movenext
      >
      > This was simple No I seem to have to write
      >
      > <td><%tblProduc ts.Rows(0)("Qua ntity")%></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.
      >[/color]

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


      --
      Rinze van Huizen
      C-Services Holland b.v

      Comment

      Working...