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

📄

📁 我做的第一个学生管理系统
💻
字号:
<%
dim Pri
mkmc=request("mkmc")
Pri=CheckUrl(mkmc)
%>
<!--#include virtual="/school/public/CheckUrl.asp"-->
<!--#include virtual="/school/public/print1.asp"-->

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>班级管理 write by longZhiping</title>
<meta name="Microsoft Theme" content="sumipntg 011">
<meta name="Microsoft Border" content="tlb, default">
<meta content="sumipntg 011" name="Microsoft Theme">
<meta content="tlb, default" name="Microsoft Border">
</head>

<body background="../images/di2001.jpg" bgcolor="#ffffff" text="#808080" link="#3333cc"
 vlink="#666699" alink="#990099">

<p><font size="6" color="#ff0000"><strong>班级管理</strong></font> <br>
<img alt="Stripe1.gif (4224 字节)" height="2" src="../images/Stripe1.gif" width="744"></p>

<OBJECT classid=clsid:BD96C556-65A3-11D0-983A-00C04FC29E33 height=3 id=rds1 
style="HEIGHT: 3px; WIDTH: 3px" width=3>
	<PARAM NAME="ExecuteOptions" VALUE="2">
	<PARAM NAME="FetchOptions" VALUE="3">
	<PARAM NAME="SortDirection" VALUE="-1">
	<PARAM NAME="InternetTimeout" VALUE="300000">
</OBJECT>



<OBJECT classid=clsid:BD96C556-65A3-11D0-983A-00C04FC29E33 height=3 id=rds2 
width=3>
	<PARAM NAME="ExecuteOptions" VALUE="2">
	<PARAM NAME="FetchOptions" VALUE="3">
	<PARAM NAME="SortDirection" VALUE="-1">
	<PARAM NAME="InternetTimeout" VALUE="300000">
</OBJECT>

<!--mstheme-->

<table width="767" mstheme>
  <tr>
    <td width="698">
            <OBJECT align=baseline 
            classid=clsid:00028CD1-0000-0000-0000-000000000046 
            CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/school/public/tdbg6.ocx"
            dataSrc=#RDS1 height=307 id=Grid1 name=grid1 vspace=1 width=682
             codeBase=http://210.0.0.210/school/public/tdbg6.ocx 
            border = 2 VIEWASTEXT></OBJECT>
<!--mstheme--></FONT></td>
    <td width="61" valign="top" windth = 100%><!--mstheme--></FONT><div align="left"><table border="0"
    width="55">
      <tr>
        <td width="51" height="1"><!--mstheme--></FONT></td>
      </tr>
      <tr>
        <td width="51"><input type="button" name="savebutton" value="保存修改"
        onclick="SubmitChanges()"
        style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 22px; WIDTH: 60px"
        height = "22" width = "60"><!--mstheme--></FONT></td>
      </tr>
      <tr>
        <td width="51" height="10"><!--mstheme--></FONT></td>
      </tr>
      <tr>
        <td width="51"><input type="button" value="取消修改" onclick="CancelUpdate()"
        style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 22px; WIDTH: 60px"
        height = "22" width = "60"><!--mstheme--></FONT></td>
      </tr>
      <tr>
        <td width="51" height="10"><!--mstheme--></FONT></td>
      </tr>
      <tr>
        <td width="51"><input type="button" value="增加班级" onclick="addrecord()"
        style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 22px; WIDTH: 60px"
        height = "22" width = "60"><!--mstheme--></FONT></td>
      </tr>
      <tr>
        <td width="51" height="10"><!--mstheme--></FONT></td>
      </tr>
      <tr>
        <td width="51"><input type="button" value="删除班级" onclick="delrecord()"
        style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 22px; WIDTH: 60px"
        height = "22" width = "60"><!--mstheme--></FONT></td>
      </tr>
       <tr>
        <td width="51" height="10"><!--mstheme--></FONT></td>
      </tr>
       <tr>
        <td width="51"><input type="button" value="打    印" onclick="printing()"
        style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 22px; WIDTH: 60px"
        height = "22" width = "60" id=button2 name=button2><!--mstheme--></FONT></td>
      </tr>
       <tr>
        <td width="51" height="10"><!--mstheme--></FONT></td>
      </tr>
       <tr>
        <td width="51" height="10"><!--mstheme--></FONT><input type="button" value="返    回" onclick="backing()"
        style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 22px; WIDTH: 60px"
        height =  "22" width = "60" name=button1><!--mstheme--></FONT></td>
      </tr>
    </table>
    </div><!--mstheme--></FONT></td>
  </tr>
  <script language="VBScript"> 

    RDS1.Server = "http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>"
    RDS1.Connect="database=school;uid=sa;pwd=;dsn=school"
    RDS1.SQL ="select  *   from  class order by 班号"
    rds1.ExecuteOptions = 1 
    RDS1.Refresh
    RDS2.Server = "http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>"
    RDS2.Connect="database=school;uid=sa;pwd=;dsn=school"
    
	'RDS2.Connect = connectionstring

	 Grid1.AllowAddnew = true
	  Grid1.AllowUpdate = true
	  Grid1.AllowDelete = true
	  Grid1.AllowArrows = true

</script>
<script language="VBScript">

public l_YN
public l_update

Sub SubmitChanges()
	moveflag = true
	
	l_UPDATE=TRUE
	
	if grid1.row > 0 then
      grid1.row = grid1.row -1
	else
		grid1.row =grid1.row +1
		moveflag = false
	end if

	grid1.Editactive = False
   On Error resume next
   RDS1.SubmitChanges
   If Err.Number <> 0 Then
      'RDS1.CancelUpdate
      MsgBox "无法更新数据!"
   End If
	if  moveflag then
      grid1.row = grid1.row +1
	else
		grid1.row = grid1.row -1
	end if

End Sub

Sub CancelUpdate()
   On Error Resume Next
   RDS1.CancelUpdate
   If Err.Number <> 0 Then
      'RDS1.CancelUpdate
      MsgBox "无法恢复原来数据!"
   End If

   Grid1.Rebind
End Sub

sub addrecord()
  'grid1.setfocus	
  grid1.EditActive = true
  rds1.recordset.addnew
  grid1.col = 0	
  'savebutton.disabled = true
  
End sub

sub delrecord()

   'while not rds1.Recordset.eof
    
   ' msgbox grid1.row
    
    
    
 '   for  i=0 to rds1.Recordset.recordcount-1
    
             
             
     '      for j=0 to rds1.Recordset.fields.count-1
             
     '        msgbox grid1.columns.item(j).value
             
     '      next  
     '      grid1.row=grid1.row+1
             
   ' next         
    

   
 '  wend  
   
	'savebutton.disabled = false
	ifdel = msgbox("是否删除此班所有信息?",4,"请特别注意!")
	if ifdel = vbNo then
		exit sub
	end if
	IF NOT rds1.recordset.EOF  and NOT rds1.recordset.BOF then
		rds1.recordset.delete
		grid1.Rebind
	else
		msgbox "已经到数据库的末尾或开始!不能删除!"
    end if 
end sub

sub SetNextrecord()
	if NOT rds1.recordset.EOF then
		rds1.recordset.movenext
		Grid1.rebind
	else
	   msgbox "It is already end of the table"
	end if 
end sub 




SUB GRID1_BeforeColUpdate(colindex,oldvalue,cancle)
	L_YN=TRUE
	new_value = grid1.columns.item(colindex)
	select case colindex
	case 0
		if len(trim(new_value)) =0 then
		    msgbox "班号不能为空!请重新输入"
		    cancle = true
		    exit sub
		end if	
		rds2.sql = "select 班号  from class where rtrim(班号) ='" & trim(new_value) & "'"
		rds2.ExecuteOptions = 1	
		rds2.refresh
		if rds2.recordset.recordCount>0 then
		    msgbox "班号重复!请重新输入"
		    cancle = true
		end if
	case 1				
		if len(trim(new_value)) =0 then
		    msgbox "班名不能为空!请重新输入"
		    cancle = true
		end if	

	case 3
		  On Error Resume Next	
		   tempi = cint(new_value)
		   if Err.number<>0 then
			msgbox "输入数据类型错!请输入数字!"
			cancle = true			
		   elseif tempi<2 or tempi>5 then
			msgbox "输入错!请输入2--5之间的数字!"
			cancle = true			
		   end if


	case 4
		   if  not Isdate(new_value) then
			msgbox "输入数据类型错!请输入日期(YYYY-MM-DD)!"
			cancle = true			
		  end if 
		
	end select
END sub

SUB GRID1_headclick1(colindex)
	' rds1.sql  =  "Select * From class Order By " & _
   ' 				Grid1.Columns.item(ColIndex).DataField  
	' rds1.Refresh
'	 if colindex >0 then
'	    Grid1.Columns.Remove ColIndex
'	 else
'		msgbox "不能删除第一列"
'	 end if 

	'Dim col As Column
   set col = Grid1.Columns.Add(Grid1.Columns.Count)
   col.Visible = True
   col.Width = 50
   col.Caption = "我的新列"
   col.DataField = rds1.Recordset.Fields("班号").Name
   col.Alignment = dbgRight

END SUB



SUB GRID1_Error(b1,C1)
	msgbox "数据类型错!请重新输入!"
	c1 =0
END SUB

SUB GRID1_SelChange(A,b)
	msgbox "select is changed"
END SUB

sub printing1()

	RDS1.recordset.movefirst 	

    call free_printer(rds1.Recordset.recordcount,"全校班级信息一览表")
 
end sub 

sub printing()
	window.open "http://220.220.220.250/school/public/print.asp","欣科软件打印模块"
	
end sub


sub backing()


  if l_yn = true then
  
   if l_update=false then
  
     l_OK=msgbox ("数据已被修改,是否保存!",1,"提示窗口")
   
     IF L_ok=1 then
     
      l_yn=TRUE
       exit sub
       
     else
      l_yn=false
      history.go(-1)
      
    end if
   else
      history.go(-1)
   end if  
    
  else
   history.go(-1)
   
 end if   

	
end sub
</script>
    

</table>
<!--mstheme--></FONT>
<SCRIPT language=javascript>
function click() {
if (event.button==2) {
alert('对不起,禁止使用此功能^_^.')
}
}
document.onmousedown=click
</SCRIPT>
</body>
</html>

⌨️ 快捷键说明

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