Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    1

    Question Unanswered: displaying it on html

    i'm not too sure abt displaying it in html table . so any advice ?

    my code look like this .

    sql = "SELECT sDetail.* FROM sDetail, newDetail where sDetail.semyear=newDetail.semyear and sDetail.sem=newDetail.sem and sDetail.modulecode=newDetail.modulecode and sDetail.tutorial=newDetail.tutorial and sDetail.startTime=newDetail.startTime and sDetail.endTime=newDetail.endTime and sDetail.location=newDetail.location and sDetail.roomno=newDetail.roomno and sDetail.tutor=newDetail.tutor"

    this is for comparing my two tables . for i hav 10 same rows in both tables . but onli my newDetail (2nd table) hav new rows and some rows with onli slight changes .

    set oConn=Server.CreateObject("ADODB.Connection")
    oConn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=fSearch;Data Source=L311C04"

    sql="select newDetail,* from newDetail left join sDetail on (newDetail.semyear=sDetail.semyear and newDetail.sem=sDetail.sem and newDetail.modulecode=sDetail.modulecode and newDetail.tutorial=sDetail.tutorial and newDetail.startTime=sDetail.startTime and newDetail.endTime=sDetail.endTime and newDetail.location=sDetail.location and newDetail.roomno=sDetail.roomno and newDetail.tutor=sDetail.tutor) where sDetail.semyear is not null"

    it works . but i want it to display in html tsble . this part i'm not too sure how to do it .
    can some experts advice me on it ?

    thanks

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Well, first, that will work, but you're overkill on the JOINs... if you have a single key field in each table that match, you only need to join on that one key field... otherwise you're causing much extra work for the SQL engine...

    Secondly, when you want to generate an HTML table, you need to loop through the recordset. I'm going to assume you know how to execute the SQL and get the recordset, so I'm going to take it from there...
    Code:
    <table>
      <tr>
        <td>
          Column1
        </td>
        <td>
          Column2
        </td>
      </tr>
    <%
      If NOT rs.BOF AND NOT rs.EOF Then
        While NOT rs.EOF
          Response.Write "<tr><td>" & rs("col1") & "</td><td>" & rs("col2") & "</td></tr>" & vbCRLF
          rs.MoveNext
        WEnd
      Else
    %>
      <tr>
        <td colspan="2">No results returned</td>
      </tr>
    <%
      End If
    %>
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    And www.asp101.com/samples has some good, short database examples.
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •