使用下拉值运行查询而不提交

时间:2013-06-25 17:13:50

标签: sql select submit refresh

<form name = "rsPass" action="<%= pagePath %><%= jspPageName %>.jsp?callrspassthru=true" method="post">
  <table cellpadding="0" cellspacing="0" width="640">
    <tr>
        <td class="wizardHeader" width="100%" style="height: 21px;">&nbsp;FCAT Scores by Teacher by Course with Gains and Years Growth</td>
    </tr>
    <tr>
        <td class="wizardInstruction" style="padding-top: 10px; padding-right: 30px; padding-left: 30px; height=33px;"valign="top">
        <br>
            This report will list all teachers, courses, and student's FCAT scores with gains.

        <br><br>
        </td> 
    </tr>
    <tr>
        <td width="100%" height="2" background="images/hr.gif"><IMG height="2" src="images/hr.gif"></td>
    </tr>

    <table width="700">

    <tr>
    <td class="detailFormColumn"><br>
        <label>Active or Inactive Teachers:  </label><br>
        <select name="active">
        <option value="">           Select   <br> </option>
        <option value="IS NULL">    Active   <br> </option>
        <option value="IS NOT NULL">Inactive <br> </option>
        </select>
    </td>
    </tr>

        
            老师姓氏的第一个字母:

 <%




 out.println(request.getParameter("active"));
 // both of these values are NULL as if they are not being read when the drop down is selected above


    Statement db1 = con.createStatement();
    int newRecords1 = 0;

    SQL1 = " SELECT DISTINCT substring(i.lastName, 1, 1) as grade " +
    " FROM employmentAssignment e with(nolock)  " +
    " JOIN calendar c with(nolock) on c.schoolID = e.schoolID " +
    " JOIN person p with(nolock) on p.personID = e.personID " +
    " JOIN [identity] i with(nolock) on i.identityID = p.currentIdentityID and i.personID = p.personID " +
    " WHERE c.calendarID = " + calID + "" +
    " AND e.enddate is " + request.getParameter("active") + "" + 
    " AND e.teacher = 1 " +
    " ORDER BY substring(i.lastName, 1, 1) ";

    result1 = db1.executeQuery(SQL1);

    out.println("<select name=grade id=15 onchange='loadStudents()'><option value='NULL' selected='true'>Select</option>");
    while(result1.next()) { grade=result1.getString(1); out.println("<option value='"+grade+"'>"+grade+"</option>");}
    out.println("</select>");

    con.close();


%>

0 个答案:

没有答案