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

📄 ++

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

<%
vServer="http://" & Request.ServerVariables("Server_name")
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>课程设置管理  write by longZhiping on 1999.8 欢迎使用欣科软件</title>


<meta name="Microsoft Theme" content="sumipntg 011"><meta name="Microsoft Border" content="tlb, default"></head>

<body background="../../images/di2001.jpg" bgcolor="#FFFFFF" text="#808080" link="#3333CC" vlink="#666699" alink="#990099"><!--msnavigation-->

<p align="left"><font color="#0000A0" size="6"><strong>课程设置管理</strong></font><br><IMG alt="Stripe1.gif (4224 字节)" height=2 
src="../../images/Stripe1.gif" width=744 ></p>
<object id="rds1" classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" width="3" height="3">
</object>

<object id="rds2" classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" width="3" height="3">
</object>
<!--msnavigation--></table><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top" width="1%">

<p> </p>
</td><td valign="top" width="24"></td><!--msnavigation--><td valign="top">

<!--msthemeseparator-->
<div align="center"></div>

<p align="center">
<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 style="LEFT: 0px; TOP: 0px" vspace=1 
	width=682 border="2" VIEWASTEXT></OBJECT>
<table border="0" width="682" height="19">
  <tr>
    <td width="682" height="19"><input type="button" value="保存修改" name="modi1" onclick="SubmitChanges()" style="background-color: rgb(192,192,192); font-family: 宋体; font-size: 12; color: rgb(0,0,255)" id=button1 name=button1>

<input type="button" value="取消修改" name="update1" onclick="CancelUpdate()" style="background-color: rgb(192,192,192); font-family: 宋体; font-size: 12; color: rgb(0,0,255)" id=button2 name=button2>
<input type="button" value="增加课程" name="insert1"onclick="addrecord()" style="background-color: rgb(192,192,192); font-family: 宋体; font-size: 12; color: rgb(0,0,255)" id=button3 name=button3>
<input type="button" value="删除课程" name="delete1" onclick="delrecord()" style="background-color: rgb(192,192,192); font-family: 宋体; font-size: 12; color: rgb(0,0,255)" id=button4 name=button4>
<input type="button" value="打    印" name="print1" onclick="printing()" style="background-color: rgb(192,192,192); font-family: 宋体; font-size: 12; color: rgb(0,0,255)" id=button4 name=button4>
<input type="button" value="返    回" name="back1" onclick="backing()" style="background-color: rgb(192,192,192); font-family: 宋体; font-size: 12; color: rgb(0,0,255)" id=button3 name=button3></td>
  </tr>
</table>
</p>

<!--<p>
&nbsp;&nbsp;&nbsp; 
<input type="button" value="保存修改" onclick="SubmitChanges()" style="background-color: rgb(192,192,192); font-family: 宋体; font-size: 16; color: rgb(0,0,255)">
&nbsp;&nbsp;
<input type="button" value="取消修改" onclick="CancelUpdate()" style="background-color: rgb(192,192,192); font-family: 宋体; font-size: 16; color: rgb(0,0,255)">
&nbsp;&nbsp;
<input type="button" value="增加课程" onclick="addrecord()" style="background-color: rgb(192,192,192); font-family: 宋体; font-size: 16; color: rgb(0,0,255)">
&nbsp;&nbsp;
<input type="button" value="删除课程" onclick="delrecord()" style="background-color: rgb(192,192,192); font-family: 宋体; font-size: 16; color: rgb(0,0,255)">
</p>//-->
<script language="VBScript">

 public insert_row
 public insert_true
 
 insert_true=false
 
 public delete_true
 
 delete_true=false
 
 public delete_value
   
    vserver= "http://<%=Request.ServerVariables("SERVER_NAME")%>"
    
    RDS1.Server =vServer
    RDS1.Connect = "database=school;uid=sa;pwd=;dsn=school"
    RDS1.SQL = "select * from  course"
    rds1.ExecuteOptions = 1
    RDS1.Refresh
    
    old_row=rds1.Recordset.recordcount
    
    'msgbox old_row 
   
    RDS2.Server =vServer
    RDS2.Connect = "database=school;uid=sa;pwd=;dsn=school"
	 Grid1.AllowAddnew = true
	  Grid1.AllowUpdate = true
	  Grid1.AllowDelete = true
	  Grid1.AllowArrows = true
</script>
<script language="VBScript">

Sub SubmitChanges()
	moveflag = 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
	
  if insert_true=true then 	
  
   rds2.sql = "alter table score add "&rds1.Recordset.fields(0)&" decimal(5,1)  null"
  
   RDS2.ExecuteOptions = 1	

   rds2.refresh
   
  end if
   
 if delete_true=true then
   
  ' msgbox "ok"
   rds2.sql = "alter table score drop column "&delete_value&""
  
   RDS2.ExecuteOptions = 1	

   rds2.refresh
         
   
  end if 
   
  INSERT_TRUE=FALSE
  
  'msgbox "保存数据成功",,"提示窗口"
  pdate1.disabled=false
  
  delete1.disabled=false
  
  insert1.disabled=false
  
  modi1.disabled=true
  
  
  'rds1.Recordset.movelast

  'msgbox rds1.Recordset.fields(0) 

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	
  insert_row=grid1.row
  
  insert_true=true
  
  update1.disabled=true
  
  delete1.disabled=true
  
  insert1.disabled=true
  modi1.disabled=false
  
End sub

sub delrecord()
	ifdel = msgbox("是否删除此课程的所有信息?",4,"请特别注意!")
	if ifdel = vbNo then
		exit sub
	end if
	IF NOT rds1.recordset.EOF  and NOT rds1.recordset.BOF then
	
	    delete_value = rds1.Recordset.fields(0)
		rds1.recordset.delete
		delete_true=true
		grid1.Rebind
        
        insert_true=true
  
       update1.disabled=true
  
       delete1.disabled=true
  
       insert1.disabled=true
       
       modi1.disabled=false
  		
		
	else
		msgbox "已经到数据库的末尾或开始!不能删除!"
    end if 
    
    
    
end sub

'===========

sub grid1_beforecoledit(colindex,keys,cancel)
		now_row=grid1.row
		'msgbox insert_row
		'msgbox now_row
	if insert_true=true then	
		
		if now_row <  insert_row then
	 		cancel= true
		else
	 		cancel= false
		end if
    else
       cancel=true
    end if		
	

end sub
'===========


SUB GRID1_BeforeColUpdate(colindex,oldvalue,cancle)
	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 course 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<1 or tempi>200 then
			msgbox "输入错!请输入1--200之间的数字!"
			cancle = true			
		   end if


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


sub printing()

	RDS1.recordset.movefirst 	

    call free_printer(rds1.Recordset.recordcount,"全校课程设置信息一览表")
 
end sub 

sub backing()
   
    history.go(-1)
      
end sub
</script>
</div>

<p>  
<!--msnavigation--></td></tr><!--msnavigation--></table><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td>

<p align="center"> </p>
</td></tr><!--msnavigation--></table></body>
</body>
</html>

⌨️ 快捷键说明

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