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

📄 targetmodify.asp

📁 一篇不错的好论文
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT"%> 
<!--#include file="Connections/StudentConn.asp" -->
<!--#include file="CheckLogin.asp"-->
<%
' *** Edit Operations: declare variables

MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_StudentConn_STRING
  MM_editTable = "TargetScore"
  MM_editColumn = "StudentNum"
  MM_recordId = "'" + Request.Form("MM_recordId") + "'"
  MM_editRedirectUrl = "TargetManage2.asp?" & session("strQureyString")
  MM_fieldsStr  = request.form("Subject")
  MM_columnsStr = replace(MM_fieldsStr,"value","',none,''")

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  total = 0
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
	if MM_fields(i+1)="" then MM_fields(i+1)="0"

    ' 计算总分
    total =total + MM_fields(i+1)
  Next


End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql update statement
  MM_editQuery = "update " & MM_editTable & " set "
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    FormVal = MM_fields(i+1)
    MM_typeArray = Split(MM_columns(i+1),",")
    Delim = MM_typeArray(0)
    If (Delim = "none") Then Delim = ""
    AltVal = MM_typeArray(1)
    If (AltVal = "none") Then AltVal = ""
    EmptyVal = MM_typeArray(2)
    If (EmptyVal = "none") Then EmptyVal = ""
    If (FormVal = "") Then
      FormVal = EmptyVal
    Else
      If (AltVal <> "") Then
        FormVal = AltVal
      ElseIf (Delim = "'") Then  ' escape quotes
        FormVal = "'" & Replace(FormVal,"'","''") & "'"
      Else
        FormVal = Delim + FormVal + Delim
      End If
    End If
    If (i <> LBound(MM_fields)) Then
      MM_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_columns(i) & " = " & FormVal
  Next
 
  '在原DW生成的代码基础上再加入总分

  MM_editQuery = MM_editQuery & ",总分 = "  & total

 
  MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the update
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim Recordset1__MMColParam,Recordset3__MMColParam
Recordset1__MMColParam= Request.QueryString("StudentNum")
Recordset3__MMColParam= Request.QueryString("StudentNum")
%>
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_StudentConn_STRING
Recordset1.Source = "SELECT StudentNum, Name  FROM StudentInfo  WHERE StudentNum = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
set Recordset3 = Server.CreateObject("ADODB.Recordset")
Recordset3.ActiveConnection = MM_StudentConn_STRING
Recordset3.Source = "SELECT *  FROM TargetScore WHERE StudentNum = '" + Replace(Recordset3__MMColParam, "'", "''") + "'"
Recordset3.CursorType = 0
Recordset3.CursorLocation = 2
Recordset3.LockType = 3
Recordset3.Open()
Recordset3_numRows = 0
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>学生成绩修改</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2600.0" Name=GENERATOR>
<link href="home.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0>
<!--#include file="Top.asp"-->
<TABLE cellSpacing=0 cellPadding=0 width=750 align=center border=0>
  <TBODY> 
  <TR> 
    <TD vAlign=top width=46 background=images/p_left_2.gif></TD>
    <TD width=20>&nbsp;</TD>
      <TD> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
          <tr> 
            <td height=30 width="20%"><img src="images/friendsite.GIF" width="19" height="19"> 
              <a href="ScoreInputStep1.asp">录入学生成绩</a></td>
            <td height=30 width="20%"><img src="images/friendsite.gif" width="19" height="19"> 
              <a href="ScoreQueryStep1.asp">查询学生成绩</a></td>
            <td height=30 width="20%"><img src="images/friendsite.gif" width="19" height="19"> 
              <a href="ScoreModifyDel.asp">修改/删除学生成绩</a></td>
            <td height=30 width="20%"><img src="images/friendsite.gif" width="19" height="19"> 
              <a href="ScoreOrder.asp">计算总分与排名</a></td>
            <td height=30 width="20%"><img src="images/friendsite.gif" width="19" height="19"><a href="TargetManage.asp">目标分管理</a></td>
          </tr>
        </TABLE>
        <table cellspacing=0 cellpadding=0 width="100%" border=0>
          <br>
          <br>
          <tbody>
            <tr> 
              <td width=120 valign=top>
                <br>
                <br>
                <font color="#FF0000"><b>查询条件:</b></font> 
          <%
			 if Request("StudentNum")<>"" then
			     response.write "学号中含有“" & strStudentNum & "”"
			 elseif strName<>"" then
			     response.write "姓名中含有“" & strName & "”"
			 else
				 if strClass<>"" then strClass=strClass & "班" 
				 response.write "高" & strGrade+1 & "级" & strClass 
			 end if
			%>              </td>
              <td width="449">
			  <form Name="Form1" action="<%=MM_editAction%>" method="POST">
                  <table cellspacing=0 cellpadding=0 width="100%" border=0>
                    <tbody>
                      <tr> 
                        <td align=center background="images/bt-001.gif" height=18><b><font size="5">修改目标分</font></b><br> 
                          <% if request("Err")<>"" then response.write "<br><font color=#3399ff>错误!此学生的成绩信息已录入!请在此修改!</font></b><br>" end if %> </td>
                      </tr>
                      <tr> 
                        <td bgcolor=#3399ff height=1></td>
                      </tr>
                      <tr> 
                        <td align="center" valign="top"> <table cellspacing=4 width="100%" border=0>
                            <tr> 
                              <td align=right width=60 height="20">学号:</td>
                              <td align=left width=373 height="20"> <%=(Recordset3.Fields.Item("StudentNum").Value)%> </td>
                            </tr>
                            <tr> 
                              <td align=right width=60 height="20">姓名:</td>
                              <td align=left width=373 height="20"> <% If Not Recordset1.EOF Or Not Recordset1.BOF Then %>
                                <%=(Recordset1.Fields.Item("Name").Value)%> 
                                <% End If ' end Not Recordset1.EOF Or NOT Recordset1.BOF %> 
                                &nbsp;</td>
                            </tr>							
                             <%
							  strSubject=""
							  For i=5 to Recordset3.Fields.Count-1
							 		response.write "<tr>"
									response.write "<td align=right width=60 height='20'>" & Recordset3.Fields.Item(i).Name & ":</td>"
                                	response.write "<td align=left width=373 height='20'><input maxlength=4 size=10 Name='" & Recordset3.Fields.Item(i).Name & "' value='" & Recordset3.Fields.Item(i).Value &"'>"
									response.write "</td></tr>"
									if strSubject<>"" then
										strSubject=strSubject & "|" & Recordset3.Fields.Item(i).Name & "|value"
									else
										strSubject= Recordset3.Fields.Item(i).Name & "|value"
									end if
							  Next
							 %>
                          </table>
                          <input type="hidden" Name="MM_update" value="true"> 
                          <input type="hidden" Name="MM_recordId" value="<%= Recordset3.Fields.Item("StudentNum").Value %>">
                    <input type="hidden" name="Subject" value="<%=strSubject%>">
                    <input type="submit" Name="Submit" value="保存修改结果"> 
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </form></td>
            </tr>
          </tbody>
        </table>
    </TD>
  </TR>
  </TBODY> 
</TABLE>
<!--#include file="CopyRight.asp"-->
</BODY>
</HTML>
<%
Recordset1.Close()
%>
<%
Recordset3.Close()
%>

⌨️ 快捷键说明

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