Thread: displaying it on html
07-15-04, 21:42 #1Registered User
- Join Date
- Jul 2004
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 .
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 ?
07-17-04, 04:37 #2Useless...
- Join Date
- Jul 2003
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...
<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.
07-18-04, 22:34 #3Guru
- Join Date
- Jun 2003