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

📄 к

📁 我做的第一个学生管理系统
💻
字号:
<%
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 欢迎使用欣科软件</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<meta name="Microsoft Theme" content="sumipntg 011">
<meta name="Microsoft Border" content="tlb, default">
<meta content="Microsoft FrontPage 3.0" name="GENERATOR">
<meta content="sumipntg 011" name="Microsoft Theme">
<meta content="tlb, default" name="Microsoft Border">
</head>

<body background="../images/Bkg35.jpg" bgcolor="#FFFFFF" text="#808080" link="#3333CC"
vlink="#666699" alink="#990099">
<p><font size="6" color="#ff0000">学生学号设置管理<object id="rds1" classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" width="0" height="0"></object>
<object id="rds2" classid="clsid:BD96C556-65A3-11D0-983A-00C04FC29E33" width="0" height="0"></object>
</font><br><img src="../images/Stripe1.gif" width="680">
<div align="center"><!--mstheme--></font><div align="center"><center>

<table border="1" width="706" height="1" bordercolorlight="#C0C0C0"
bordercolordark="#003366">
  <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" width="565" VIEWASTEXT>
    </object>
    <font color="#003366">查询条件:<input id="condition_ID" size="68"> 查询栏目: <select
    id="field_id" size="1" onfocus="field_gotfocus()" onblur="field_getSelect()">
      <option value="1" selected>学号</option>
    </select>&nbsp; 比 较:<select name="compare_id" size="1" onblur="compare_getSelect()">
      <option value="1" selected>等于 = </option>
      <option value="2">大于 &gt; </option>
      <option value="3">小于 &lt; </option>
      <option value="4">小于等于&lt;= </option>
      <option value="5">大于等于&gt;= </option>
      <option value="5">不等于&lt;&gt; </option>
      <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>
      <option value="2">或者</option>
    </select> </font><!--mstheme--></font></td>
    <script language="VBScript">
	
	
    public l_update
     
	dim  fieldname(40),lastxh,lastbh,firstadd
	colcount = 0
	compare_select = false
	field_select = false
	express_input = false
	logic_select = false
	
	l_update = false
	
	firstadd = false
    search_flag = false
    lastxh = "    "
    lastbh = "    "
    
    RDS1.Server = "http://<%=Request.ServerVariables("Server_name")%>"
    RDS1.Connect="database=school;uid=sa;pwd=;dsn=school"
    savesql = "select 学号,班号,姓名,性别,图片 from  student "
	'savesql =rds1.sql 
	rds1.SQL = savesql + "order by 学号 "
	RDS1.Refresh
    
    
    RDS2.Server = "http://<%=Request.ServerVariables("Server_name")%>"
    RDS2.Connect="database=school;uid=sa;pwd=;dsn=school"
    RDS2.SQL = "select 学号,班号,姓名,性别,图片 from  student order by 学号"
    RDS2.Refresh
    grid1.AllowAddnew = true
    grid1.AllowDelete = true
    grid1.AllowUpdate = true
	'grid1.setfocus
	'col1=Grid1.Columns.item(3) 
	'Col1.Caption = "图片"
	'col1.button = true
	
	
</script>
<td width="113" height="24" valign="top"><form
    method="post" action="--WEBBOT-SELF--">
      <p><img id="photoid" datasrc="#rds1" Datafld="图片" width="116" height="172"
      alt="学生相片"></p>
    </form>
<!--mstheme-->    </font></td>
  </tr>
  <tr>
    <td width="113" height="1" valign="top"><form method="post" action="--WEBBOT-SELF--">
<!--mstheme-->      </font><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"> 
      <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"> 
      <input type="button" value="增加记录" name="B3" onclick="addrecord()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px"> 
      <input type="button" value="删除记录" name="B4" onclick="delrecord()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px"> 
      <input type="button" value="查    询" name="B7" onclick="freeSearch()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px"> 
      <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">
      <input type="button" value="打    印" name="B7" onclick="printing()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px">
      <input type="button" value="返    回" name="B7" onclick="returning()" style="BACKGROUND-COLOR: rgb(192,192,192); COLOR: rgb(0,0,255); FONT-FAMILY: 宋体; FONT-SIZE: 12px"></font><!--mstheme--></font><!--mstheme--></font>
      </center></div>
<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
	
	l_update=false

End Sub

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

sub addrecord()
  'grid1.setfocus	
  grid1.EditActive = true
  rds1.recordset.addnew
  
  grid1.col = 0	
  if firstadd then
	  grid1.columns.item(0).value = lastxh 'LEFT(trim(lastxh),len(trim(lastxh))-3)+cstr(cint(right(trim(lastxh),3)))
	  'lastxh = grid1.columns.item(0).value
	  grid1.columns.item(1).value = lastbh
  end if 
  firstadd = true
  
  l_update = true
End sub

sub delrecord()
	IF NOT rds1.recordset.EOF  and NOT rds1.recordset.BOF then
		
		L_OK=MSGBOX("你是否删除此数据",1,"提示窗口")
		
		IF L_OK=1 THEN
		  rds1.recordset.delete
		  grid1.Rebind
		END IF
		  
	else
	
	   msgbox "已经到数据库的末尾或开始!不能删除!"
	   	
   end if
    
    l_update = true
    
end sub

sub grid1_BeforeColEdit(colindex,keyascii,cancel)
	
	set colsel = grid1.columns.item(colindex)
	select case colsel.caption
	case "性别"
		'colsel.button = true
		if grid1.columns.item(colindex).value = "男" then 
			 grid1.columns.item(colindex).value = "女"
		else
			 grid1.columns.item(colindex).value = "男"
		end if 
		cancel = true
	case "图片" 
		'photodlg.showopen
		'if len(trim(photodlg.filename))>0 then
			'msgbox photodlg.filename
		'	grid1.columns.item(colindex).value = photodlg.filename
		'end if				
		'cancel = true	
	end select

end sub


sub grid1_buttonclick(colindex)
	sexpopup.popup	
end sub 

sub sexpopup_click(intitem)
	if intitem =1 then
		grid1.columns.item(3).value ="男"
	else
	    grid1.columns.item(3).value ="女"
	end if 

end sub 

sub grid1_BeforeColUpdate(colindex,oldvalue,cancle)
	new_value = grid1.columns.item(colindex)
	select case colindex
	case 0
		
		rds2.sql = "select 学号  from student where 学号 like '" & _
					trim(new_value)&"%'"
		rds2.ExecuteOptions = 1	
		rds2.refresh
		if rds2.recordset.recordCount>0 then
		    msgbox "学号重复!请重新输入"
		    cancle = true
		    exit sub
		else
			lastxh = rtrim(grid1.columns.item(colindex).value)
			grid1.columns.item(4).value="\\qhsf\xs_photo\"+rtrim(grid1.columns.item(colindex).value)+".bmp"
		end if
	case 1
		
		rds2.sql = "select 班号  from class where 班号 like '" & _
					trim(new_value)&"%'"
		rds2.ExecuteOptions = 1	
		rds2.refresh
		if rds2.recordset.recordCount<=0 then
		    msgbox "没有此班号!请重新输入"
		    cancle = true
		    exit sub
		else 
			lastbh = rtrim(grid1.columns.item(colindex).value)
		end if
	case 2
		if len(trim(new_value)) =0 then
		    msgbox "姓名不能为空!请重新输入"
		    cancle = true
		    exit sub
		end if	
	case 4
		
			
	end select
	
	l_update = true
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 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
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 "条件不能为空,请先输入条件表达式!"

	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 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 freeOrder()

end sub


sub freeSearch()
	if len(trim(condition_id.value))=0 then
		msgbox "请先输入查询条件!"
		exit sub
	end if
	rds1.sql =savesql + " 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


sub backing()

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

sub returning()


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

	
end sub


sub printing()

	RDS1.recordset.movefirst 	

    call free_printer(rds1.Recordset.recordcount,"学生学号信息一览表")
 
end sub 

</script>

    </form>
<!--mstheme-->    </font></td>
  </tr>
</table>
</center></div>

</div>

<p>
<OBJECT classid="CLSID:F9043C85-F6F2-101A-A3C9-08002B2F49FB" height=32 id=PhotoDlg 
	style="HEIGHT: 68px; LEFT: 151px; TOP: 288px; WIDTH: 124px" width=32>
	<PARAM NAME="_ExtentX" VALUE="847">
	<PARAM NAME="_ExtentY" VALUE="847">
	<PARAM NAME="_Version" VALUE="393216">
	<PARAM NAME="CancelError" VALUE="0">
	<PARAM NAME="Color" VALUE="0">
	<PARAM NAME="Copies" VALUE="1">
	<PARAM NAME="DefaultExt" VALUE="*.jpg;*.bmp;*.gif">
	<PARAM NAME="DialogTitle" VALUE="选择学生相片文件">
	<PARAM NAME="FileName" VALUE="">
	<PARAM NAME="Filter" VALUE="图形文件 (*.jpg;*.bmp;*.gif)">
	<PARAM NAME="FilterIndex" VALUE="0">
	<PARAM NAME="Flags" VALUE="0">
	<PARAM NAME="FontBold" VALUE="0">
	<PARAM NAME="FontItalic" VALUE="0">
	<PARAM NAME="FontName" VALUE="">
	<PARAM NAME="FontSize" VALUE="8">
	<PARAM NAME="FontStrikeThru" VALUE="0">
	<PARAM NAME="FontUnderLine" VALUE="0">
	<PARAM NAME="FromPage" VALUE="0">
	<PARAM NAME="HelpCommand" VALUE="0">
	<PARAM NAME="HelpContext" VALUE="0">
	<PARAM NAME="HelpFile" VALUE="">
	<PARAM NAME="HelpKey" VALUE="">
	<PARAM NAME="InitDir" VALUE="..\images">
	<PARAM NAME="Max" VALUE="0">
	<PARAM NAME="Min" VALUE="0">
	<PARAM NAME="MaxFileSize" VALUE="260">
	<PARAM NAME="PrinterDefault" VALUE="1">
	<PARAM NAME="ToPage" VALUE="0">
	<PARAM NAME="Orientation" VALUE="1"></OBJECT>
</p>
<!--mstheme--></font>
</body>
</html>

⌨️ 快捷键说明

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