...

Error Show data from DB

h2q1
04-15-2007, 10:45 AM
I have some issues, please help me ... :(
First, see DB (relate with my part..)
http://quangnd0003.googlepages.com/anhthu.bmp

I want show data from DB, my code follow:
<% openConn 'open Connection
set rsMark = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM Subject"
strSQL = strSQL & " JOIN Mark ON Subject.Subject_id=Mark.Subject_id"
strSQL = strSQL & " WHERE Student_id=063106445"
rsMark.open strSQL, oConn
%>
<table width="100%" border="1" cellspacing="0" cellpadding="2">
<%
Response.Write "<tr><th>STT</th>"
Response.Write "<th>Năm học</th>"
Response.Write "<th>Học kỳ</th>"
Response.Write "<th>Môn học</th>"
Response.Write "<th>Kiểm tra</th>"
Response.Write "<th>Lần 1</th>"
Response.Write "<th>Lần 2</th>"
Response.Write "<th>Học trình</th></tr>"
%>
<%
cnt=0 'count number record
do while not rsMark.EOF
cnt = cnt + 1
%>
<tr>
<td><%=cnt%></td>
<td><%=rsMark("Year")%></td>
<td><%=rsMark("Term")%></td>
<td><%=rsMark("Subject_name")%></td>
<td><%=rsMark("Test")%></td>
<td><%=rsMark("Mark")%></td>
<td><%=rsMark("ResistMark")%></td>
<td><%=rsMark("No_of_lesson")%></td>
</tr>
<%
rsMark.Movenext
Loop
%>
</table>
and result at here:
http://quangnd0003.googlepages.com/ketqua.bmp

why data in cell Subject_name, Mark, ResistMark,No_of_lesson not display ! :(
(I tried run with SQL Query Analyzer and success...string SQL was correct! and results were returned is fully ! ... why ?)
someone explain for me ... hichic

thanks a lot !

degsy
04-18-2007, 02:03 PM
Just as a test, what happens if you output the fields from a loop instead of referencing the field name

Here is an example using a for each loop
http://www.w3schools.com/ado/ado_display.asp


Also, try referencing the all of the required field names in the query instead of using *



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum