asp没有渲染数据

时间:2017-08-01 02:01:09

标签: html mysql asp.net

我从显示计划的客户ASP页面中获得以下代码。 MySQL表中有数据,连接良好。使页面呈现适当数据的缺失是什么?页面仅呈现表格的第一个开头,页面的其余部分为空白。

<%
SQL1= "SELECT * FROM tbl_schedule  Order By BeginDate ASC"
Set cmd1 = Server.CreateObject("ADODB.Command")    
cmd1.ActiveConnection = Conn
cmd1.CommandText = SQL1
cmd1.CommandType = adCmdText
Set RS1 = cmd1.Execute()

IF NOT RS1.EOF THEN 'RS1


    Response.Write "<table border=2 frame=void rules=all cellpadding=2 cellspacing=0 width=800>"
    Response.Write "<tr valign=top><th width=225>Class</th>"
    Response.Write "<th width=25>Status</th>"
    Response.Write "<th width=150>Date</th>"
    Response.Write "<th width=100>Location</th>"
    Response.Write "<th width=100>Seats available</th>"
    Response.Write "<th width=100>Details &amp; Sign Up</th></tr>"
    Do until RS1.EOF

    IF RS1("BeginDate") > Date() THEN

    SQL2 = "SELECT Name as ClassName FROM tbl_lkup_classes WHERE ID = ?"
    Set cmd2 = Server.CreateObject("ADODB.Command")    
    cmd2.ActiveConnection = Conn
    cmd2.CommandText = SQL2
    cmd2.CommandType = adCmdText
    cmd2.Parameters(0) = RS1("Class")
    Set RS2 = cmd2.Execute()

    Response.Write "<tr valign=top>"
    Response.Write "<td>"&Trim(RS2("ClassName"))&"</td>"
    Response.Write "<td><font color=#b22222>"
        IF RS1("Status") = "A" THEN
        Response.Write "Active"
        End IF
        IF RS1("Status") = "C" THEN
        Response.Write "Cancelled"
        End IF
    Response.Write "</font></td>"
    Response.Write "<td>"&FormatDatetime(RS1("BeginDate"),1)&"</td>"
    Response.Write "<td>"&Trim(RS1("Location_city"))&", "&Trim(RS1("Location_state"))&"</td>"

        SQL3= "SELECT Count(Student_ID) as ClassCount FROM tbl_roster WHERE Class_ID = ?"
        Set cmd3 = Server.CreateObject("ADODB.Command")    
        cmd3.ActiveConnection = Conn
        cmd3.CommandText = SQL3
        cmd3.CommandType = adCmdText
        cmd3.Parameters(0) = RS1("ID")
        Set RS3 = cmd3.Execute()
        strSlotsAvailable = Cint(RS1("Slots")) - Cint(RS3("ClassCount"))
        Response.Write "<td align=center><div align=center>"&strSlotsAvailable&"</div></td>"
        Response.Write "<td align=right><a href=ClassDetails.asp?RecID="&RS1("ID")&">Details &amp; Sign up</a></td></tr>"

    END IF
    RS1.MoveNext
    LOOP
    Response.Write "</table>"


Else 'RS1

Response.write "There are no currently scheduled classes.<br /><br />"

end If 'RS1
%>

0 个答案:

没有答案