⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bank_report.asp

📁 ASP+SQL Server动态网站开发从基础到实践教程
💻 ASP
字号:
<%Option Explicit

function Rec2Table(objRS)
dim strT
dim fldF

strT="<table width=80% border=1><TR>"

	for each fldF in objRS.Fields	'each feild as colum name
	strT=strT & "<TD>" & fldF.name & "</TD>"
	next
strT=strT & "</TR>"

	while not objRS.eof
	strT = strT & "<TR>"
		for each fldF in objRS.fields
		strT = strT & "<TD>" & fldF.value & "</TD>"
		next
	strT= strT & "</TR>"
	objRS.movenext
	wend
strT = strT & "</TABLE>"
Rec2Table =strT 'return the table string
end function  
%>

<!-- #INCLUDE FILE = "connect_ama.asp" -->

<!-- #INCLUDE FILE = "adovbs.inc"  -->
              
<HTML>
<HEAD>
<TITLE>Find Director</TITLE>
</HEAD>
<BODY>
<table width="80%" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
<tr><td style="WIDTH: 500px" width=500 bgColor=gold 
      ><P align=right><strong style="font-weight: 400"><font size="4">试题库报表</font></strong></P>
</td>     
</tr>
</table>

<p> </p>

<%
  Dim strSQL            ' SQL String
  Dim objRS, objField   ' ADO Recordset and Field objects
  Dim intCount          ' number of fields selected
  Dim vbQuote           ' quote character
  vbQuote = Chr(34)

  
  ' Check whether the user has checked any boxes to select some fields.  
  ' If so, we'll display a table of data
  If Request.Form("Field").Count > 0 Then
    ' Find out which fields are to be selected
    strSQL = ""
    For intCount = 1 to Request.Form("Field").Count
      strSQL = strSQL & Request.Form("Field")(intCount) & ", "
    Next

    ' Strip the trailing comma and space (added in the loop) from end of strSQL
    strSQL = Left(strSQL, Len(strSQL) - 2)

    ' Add the SELECT command and the FROM criteria
    strSQL = "SELECT " & strSQL & " FROM q_bank"

    ' If user requested a particular director, add a WHERE clause
    ' (otherwise they'll get data for all directors)
    If Request.Form("q_id1") <> "" and Request.Form("q_id1")<> "" Then
      strSQL = strSQL & " WHERE q_id BETWEEN " & Request.Form("q_id1") & " AND " & Request.Form("q_id2")
    End If

    Set objRS = Server.CreateObject ("ADODB.Recordset")
    objRS.Open strSQL, myconn,3' adOpenForwardOnly, adLockReadOnly, adCmdText
	'Response.Write strSQL &"<hr>" &objRS.recordcount & "<hr>"
    ' Write a table of the recordset
    Response.Write Rec2Table (objRS)

    ' Clean up
    objRS.Close
    Set objRS = Nothing
  End If
%>

<FORM NAME=MovieInfo ACTION="bank_report.asp" METHOD="POST">
  选择开始试题序号: 
 	  
 	  <select size="1" name="q_id1">      
      <%
       '''''''''''''''''''''''''''''''''''''''''''''''''''      
       
       	Set objRS = Server.CreateObject ("ADODB.Recordset")
    	objRS.Open "q_bank", myconn
    
      objRS.movefirst
      while not objRS.EOF
      response.write "<option value=" & objRS("q_id") & ">" & objRS("q_id") &"</option>"
      objRS.movenext
      wend
      ''''''''''''''''''''''''''''''''''''''''''''''''''''
      %>
      </select>
      选择结束试题序号:
      <select size="1" name="q_id2">      
      <%
       '''''''''''''''''''''''''''''''''''''''''''''''''''      
      objRS.movefirst
      while not objRS.EOF
      response.write "<option value=" & objRS("q_id") & ">" & objRS("q_id") &"</option>"
      objRS.movenext
      wend
      ''''''''''''''''''''''''''''''''''''''''''''''''''''
	
	' Clean up
    objRS.Close
    Set objRS = Nothing
      %>
      </select>

  <BR><BR>
  请选择需要显示的试题信息:<BR>
  <%
    
    Set objRS = Server.CreateObject ("ADODB.Recordset")
    objRS.Open "q_bank",myconn, _
                    adOpenForwardOnly, adLockReadOnly, adCmdTable
   
    ' Create a checkbox in the form for each field in the recordset
    For Each objField in objRS.Fields
      Response.Write "<INPUT TYPE=CHECKBOX NAME=" & vbQuote & "Field" & vbQuote & _
                     " VALUE=" & vbQuote & objField.Name & vbQuote & ">" & _
                     objField.Name 
    Next
    objRS.Close   ' clean up
    Set objRS = Nothing
  %>
  <BR><INPUT TYPE=submit VALUE="生成报表"><INPUT TYPE=reset VALUE="清空">
</FORM>
<p> </p>
<table width="80%" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
<tr><td style="WIDTH: 500px" width=500 bgColor=gold 
      ><P align=right><strong style="font-weight: 400"><font size="4">
	<a href="control_panel.asp">在线考试系统</a></font></strong> </P>
</td>     
</tr>
</table>

</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -