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

📄 +

📁 我做的第一个学生管理系统
💻
字号:
<%
dim Pri
mkmc=request("mkmc")

Pri=CheckUrl(mkmc)
%>

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

%>
<!--#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>基本资料管理  欢迎使用欣科软件 by longzhiping</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">


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

<body background="../_themes/sumipntg/di2001.jpg"  topmargin="0">
<p><font color="#FF0000" size ="6"><strong>学生基本信息管理</strong></font>  
<OBJECT classid=clsid:BD96C556-65A3-11D0-983A-00C04FC29E33 height=0
          id=RDS1 width=0><PARAM NAME="ExecuteOptions" VALUE="2">
          <PARAM NAME="FetchOptions" VALUE="3">
          <PARAM NAME="SortDirection" VALUE="-1">
		  <PARAM NAME="InternetTimeout" VALUE="300000">
		  </OBJECT>
<IMG  src ="../images/Stripe1.gif" width=744 >

<div align="center"><center>
<table border="1" width="706" height="1" cellspancing="0" cellpadding="0">
  <tr> 
    <td width="581" height="1" rowspan="2" valign="top">
<OBJECT classid="clsid:00028CD1-0000-0000-0000-000000000046" 
             CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/school/public/tdbg6.ocx" 
	dataSrc=#rds1 height=320 id=grid1 style="LEFT: 0px; TOP: 0px" width=565 VIEWASTEXT></OBJECT>
<font color="#003366">
    查询条件:<input id="condition_ID" size="40" ><br>
    查询栏目: <select id="field_id" size="1" onfocus="field_gotfocus()" onblur="field_getSelect()">
				<option value="1" selected>学号</option>    </select> 
	 比 较:<select name="compare_id" size="1" onblur="compare_getSelect()">
			  <option value="1" 
              selected>等于 =
			  <option value="2">大于 &gt;
			  <option value="3">小于 &lt; <option value="4">小于等于&lt;= <option value="5">大于等于&gt;=
			  <option value="5">不等于&lt;&gt;
			  <option value="6">包含</option>
			  </select>
	  条 件:<input name="express_id" size="10" onblur="express_input()" >
	  逻 辑:<select id="logic_id" size="1" onfocus="logic_getfocus()" onblur="logic_getSelect()">
	  <option value="1" selected>并且
	  <option value="2">或者</option>
	  </select></font></td>
        
<script language="VBScript">
    dim fieldname(40)
	colcount = 0
	compare_select = false
	field_select = false
	express_input1 = false
	logic_select = false
	search_flag = false
	public l_yn
	public l_update



    RDS1.Server="http://<%=REQUEST.SERVERVARIABLES("SERVER_NAME")%>" 

    RDS1.Connect="database=school;uid=sa;pwd=;dsn=school"

    RDS1.SQL = "select * from baseinfo order by 学号"            
	saveSQL = RDS1.SQL
'	RDS1.ExecuteOptions = 1
    RDS1.Refresh

    grid1.AllowAddnew = true
    grid1.AllowDelete = false
    grid1.AllowUpdate = true
   
</script>

<td width="120" height="24" valign="top">
	<form method="post" action="../_vti_bin/shtml.dll/student/基本资料.asp" webbot-action="--WEBBOT-SELF--">
     <p><img id="photoid" datasrc="#rds1" Datafld="图片" width="116" height="160" alt="学生相片"></p>
    </form>
</td></tr>
  <tr>
    <td width="120" height="1" valign="top"><form method="post" action="../_vti_bin/shtml.dll/student/基本资料.asp" webbot-action="--WEBBOT-SELF--">
     <p> <div align="center"><center>
           <!--mstheme--><font color="#003366">
	  <font color="#003366">
	  <input type="button" value="保存修改" name="B1" onclick="submitChanges()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 25px" height=25> 
      <input type="button" value="取消修改" name="B2" onclick="CancelUpdate()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 25px" height=25>       
      
	  <input type="button" value="资料刷新" name="B5" onclick="refreshing()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 25px" height=25>
	  <input type="button" value="查    询" name="B6" onclick="freeSearch()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 25px" height=25>
      <input type="button" value="打    印" name="B8" onclick="printing()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 25px" height=25>
	  <input type="button" value="返    回" name="B7" onclick="backing()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px; HEIGHT: 25px" height=25>

	  </font><!--mstheme--></font>
      </center></div>

<script language="VBScript">

public titlename

sub printing()

	RDS1.recordset.movefirst 	

   titlename=inputbox("请输入打印的标题名称!","提示窗口")
	'if len(rtrim(tiltename))>0 then
		call printer()
	'end if
 
end sub



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 "无法更新数据!"
     else
     l_update=true 
   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() 
  msgbox "不能运行增加功能,如要增加请运行学号管理模块!"	   	
  exit sub
  grid1.EditActive = true
  rds1.recordset.addnew
  grid1.col = 0	
  
End sub

sub delrecord()
	'exit sub
	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 grid1_BeforeColEdit(colindex,keyascii,cancel)
	'dim selcolname 
	l_yn=true
	'msgbox l_yn
    selcolname = Grid1.Columns.item(colindex).caption
	if selcolname="学号" or selcolname="班号" or selcolname="姓名" _
		or selcolname="性别" or selcolname="图片" then

		msgbox selcolname+"不能修改!如要修改请运行学号管理模块!"
		cancel = true
	 end if
	

end sub


sub field_getSelect()
	if field_select then
		exit sub
	end if
	condvalue = condition_id.value
	condition_id.value = condvalue + fieldname(field_id.selectedindex)	
	field_select = true
	compare_select = false
	express_select = false
	logic_select = false
	compare_id.focus
end sub

sub compare_getSelect()
	if compare_select then
		msgbox "已经输入比较操作符!"
		exit sub 
	end if 
	
	
	condvalue = condition_id.value
	if len(trim(condvalue)) = 0 then
		condvalue = "学号"
	end if
	select case compare_id.selectedindex
		case 0
			condvalue = condvalue + "="
		case 1
			condvalue = condvalue + ">"
		case 2
			condvalue = condvalue + "<"

		case 3
			condvalue = condvalue + "<="
		case 4
			condvalue = condvalue + ">="
		case 5
			condvalue = condvalue + "<>"
		case 6
			condvalue = condvalue + " like "
	end select 
	condition_id.value = condvalue
	compare_select = true
	
end sub

sub logic_getfocus()
    if len(trim(express_id.value))=0 then		
		msgbox "条件不能为空,请先输入条件表达式!"
		express_id.focus()
		
	end if
end sub 

sub logic_getSelect()
	if logic_select then
		exit sub
	end if 
	condvalue = condition_id.value
	select case logic_id.selectedIndex
		case 0
			condvalue = condvalue + " and "
		case 1
			condvalue = condvalue + " or "
	end select
	condition_id.value=condvalue
	logic_select = true
	field_select = false
end sub

sub field_Gotfocus()
	if len(trim(condition_id.value)) = 0 then
		field_select = false
		compare_select = false
		express_select = false
		logic_select = false
	end if

	if colcount > 0 then
		exit sub
	end if 
	colcount = grid1.columns.count
	fieldname(0)="学号"
	for i=1 to colcount-1 
		  colcaption = grid1.columns.item(i).caption
		  fieldname(i) = colcaption
		  set oOption = document.createElement("OPTION")
		  oOption.text  = colcaption
	      oOption.value = cstr(i+1)
	      document.all.field_id.add(oOption)		
	next

end sub 


sub express_input()
	condvalue = condition_id.value
	if not compare_select then
		msgbox "请先输入比较操作符!"
		exit sub
	end if
	if len(trim(condvalue))=0 then
		condvalue = "学号="
	end if
	if len(trim(express_id.value))>0 and compare_id.selectedindex <> 6 then
		condvalue = condvalue + "'" + express_id.value + "'"
		condition_id.value = condvalue
    elseif len(trim(express_id.value))>0 and compare_id.selectedindex = 6 then
		condvalue = condvalue + "'%" + express_id.value + "%'"
		condition_id.value = condvalue
	else
		msgbox "条件不能为空,请重新输入条件表达式!"
	end if
end sub


sub freeSearch()
	if len(trim(condition_id.value))=0 then
		msgbox "请先输入查询条件!"
		exit sub
	end if
	rds1.sql =" select * from baseinfo where " + condition_id.value
	'msgbox rds1.sql
	on error resume next
	rds1.ExecuteOptions = 1	
	rds1.refresh

	if rds1.recordset.recordcount = 0 then
		msgbox "对不起!没有找到符合条件的记录!"
		rds1.sql = saveSQL
		rds1.refresh
	else
		msgbox "总共找到 " + cstr(rds1.recordset.recordcount) +" 条符合条件的记录!"
		search_flag = true
	end if
end sub



Private Sub Grid1_HeadClick(ColIndex)

   if  griD1.columns.item(colinDex).caption="姓名" then
		
   else		
		Grid1.Columns.Remove ColIndex

end if
   
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=false
       exit sub
     else
      l_yn=false
      history.go(-1)
      
    end if
   else
      history.go(-1)
   end if  
    
  else
   history.go(-1)
   
 end if   

	'if search_flag then
	'	rds1.sql = saveSQL
	'	rds1.refresh
'	end if
	
end sub



sub refreshing()

	if search_flag then
		rds1.sql = saveSQL
		rds1.refresh
                condition_ID.value=""
	end if
	
end sub


</script>           
<SCRIPT language=javascript>
function click() {
if (event.button==2) {
alert('对不起,禁止使用MOUSE右键功能')
}
}
document.onmousedown=click
</SCRIPT>

    </form></tr>
      </p></table></center></p></div>

<!--msnavigation-->
    
    </td>
  </tr><!--msnavigation-->

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

</td></tr><!--msnavigation--></table></body>
</html>

⌨️ 快捷键说明

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