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

📄 +

📁 我做的第一个学生管理系统
💻
📖 第 1 页 / 共 2 页
字号:
<%
vServer="http://" & Request.ServerVariables("Server_name")
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb_2312-80">
<meta name="tjh" content="Microsoft FrontPage Express 2.0">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>基本资料项目设置 欢迎使用欣科软件</title>
</head>

<body background="di2001.jpg">

<p><font size="6" color="#ff0000">基本资料项目设置 
<object align="baseline" classid="ClsID:BD96C556-65A3-11D0-983A-00C04FC29E33" height="4"
id="RDS1" width="25" border="0">
  <param name="ExecuteOptions" value="2">
  <param name="FetchOptions" value="3">
  <param name="SortDirection" value="-1">
  <param name="InternetTimeout" value="300000">
</object>
<object align="baseline" classid="ClsID:BD96C556-65A3-11D0-983A-00C04FC29E33" height="12"
id="RDS2" width="26" border="0">
  <param name="ExecuteOptions" value="2">
  <param name="FetchOptions" value="3">
  <param name="SortDirection" value="-1">
  <param name="InternetTimeout" value="300000">
</object>
</font>

<hr color="#ff0000">

<input type="button" value="第一条" onclick="movefirst()" id="button1"
name="button1" style="font-family: 楷体_GB2312; font-size: 15"> <input type="button"
value="上一条" onclick="MovePrevious()" id="button2" name="button2"
style="font-family: 楷体_GB2312; font-size: 15"> <input type="button" value="下一条"
onclick="MoveNext()" id="button3" name="button3"
style="font-family: 楷体_GB2312; font-size: 15"> <input type="button"
value="最后一条" onclick="MoveLast()" id="button4" name="button4"
style="font-family: 楷体_GB2312; font-size: 15"> <input type="button" value="添  加" id="ins" name="ins"
onclick="recordadd()" id="button5" name="button5"
style="font-family: 楷体_GB2312; font-size: 15"> <input type="button" value="删  除" id="del"
onclick="recorddelete()" id="button6" name="button6"
style="font-family: 楷体_GB2312; font-size: 15"> <input type="button" value="保  存" id="update1"
onclick="SubmitChanges()" id="button7" name="button7"
style="font-family: 楷体_GB2312; font-size: 15"> <input type="button" value="取  消"
onclick="cancleupdate()" id="button8" name="button8"
style="font-family: 楷体_GB2312; font-size: 15"> <input type="button" value="返  回"
onclick="backing()" id="button9" name="button9"
style="font-family: 楷体_GB2312; font-size: 15">
<script language="vbscript">
     
    public  text11
    
    public l_ins
    
    l_ins=true
    
    public l_del
    
    l_del=true
    
    public l_update
    
    l_update=false

    RDS1.Server ="http://<%=Request.ServerVariables("Server_name")%>"

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

    RDS1.SQL =   "select * from baseitem_set order by convert(int,序号)"  
    RDS1.Refresh

    RDS2.Server = "http://<%=Request.ServerVariables("Server_name")%>"
    RDS2.Connect="database=school;uid=sa;pwd=;dsn=school"

</script>
<div align="left">

<table border="1" width="100%">
  <tr>
    <td valign="top" width="65%">
    <OBJECT align=baseline classid="clsid:00028CD1-0000-0000-0000-000000000046" 
     CODEBASE="http://<%=Request.ServerVariables("SERVER_NAME")%>/school/public/tdbg6.ocx"
	dataSrc=#rds1 height=329 id=grid1 name=grid1 style="LEFT: 0px; TOP: 0px" width=510 
	codeBase="http://210.0.0.210/school/public/tdbg6.ocx"
	border = 0 VIEWASTEXT></OBJECT>
    </td>
    <td valign="top" width="35%"><h5>&nbsp;<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font
    color="#0000ff" face="宋体"> </font><font color="#0000ff" size="2">使用说明</font></h5>
    <h5><font color="#0000ff">(1)项目名称:字段名称&nbsp;&nbsp; 
    类型:字段数据类型&nbsp; 宽度:字段数据宽度&nbsp; 
    小数:字段小数位</font></h5>
    <h5><font color="#0000ff">(2)项目名称严格按照字段名要求定义,不得重复</font></h5>
    <h5><font color="#0000ff">(3)类型必须为字符型(char)位型(bit)、整数型(int)、日期时间型(datetime)、和精确数值型(decimal)</font></h5>
    <h5><font color="#0000ff">(4)bit、int、datetime类型的宽度和小数为空,char型的宽度大于零、decimal型的宽度大于1、小数必须小于宽度</font></h5>
    <h5><font color="#0000ff">(5)基本项目不能删改</font></h5>
    </td>
  </tr>
</table>
</div>

<p><script language="vbscript">

  grid1.AllowAddNew = true
  grid1.AllowDelete = true
  grid1.AllowUpdate = true
  grid1.AllowArrows = true
 
</script> <script language="vbscript">

 PUBLIC  x(20,3)
 
 public  y(40,3)

 public  z(40,3)
  
 PUBLIC l_button

 l_button="1"
   
 PUBLIC row_1

 public l_count

 public l_delete

 l_delete=0

 public l_tag

 l_tag="1"
   
sub grid1_BeforeColEdit()

   grid1.editactive = true

end sub

sub recordadd()

   
   row_1=0
   
   RDS2.sql="select max(convert(int,序号)) from baseitem_set "
   RDS2.ExecuteOptions =1
   RDS2.Refresh 
  
  
   ins.disabled=true
   del.disabled=true
   
   grid1.editactive=true
   
   rds1.recordset.addnew
 
   rds1.recordset.movelast
   
   grid1.Columns.Item(0).Value=RDS2.Recordset.fields(0)+1
 
   
   
end sub

'sub grid1_click()

'msgbox grid1.row



'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   baseitem_set where rtrim(序号) ='" & trim(new_value) & "'"
		rds2.ExecuteOptions = 1	
		rds2.refresh
		if rds2.recordset.recordCount>0 then
		    msgbox "序号重复!请重新输入"
		    cancle = true
			exit sub
		end if
	case 1				
		if len(trim(new_value)) =0 then
		    msgbox "项目名称不能为空!请重新输入"
		    cancle = true
			exit sub
		end if
		
		rds2.sql = "select *  from baseitem_set where rtrim(项目名称) ='" & trim(oldvalue) & "' or  rtrim(项目名称) ='" & trim(new_value) & "'  "
		rds2.ExecuteOptions = 1	
		rds2.refresh
		if rds2.recordset.recordCount>0 then
		    msgbox "此项目名称已存在表中!不得修改!"
		    cancle = true
			exit sub
		end if	
	   
	   	

	case 2

	  if rtrim(new_value)="bit" then
        
		 if len(trim(grid1.columns.item(3)))>0 then

		    msgbox "宽度和小数只能为空!"
			 
		 end if

          cancle=false
		  exit sub
	     
	    elseif  rtrim(new_value)="int" then
		 
		 if len(trim(grid1.columns.item(3)))>0 then

		    msgbox "宽度和小数只能为空!"
			 
		 end if
		 cancle=false

		  exit sub

		   elseif rtrim(new_value)="datetime" then
		   
		   if len(trim(grid1.columns.item(3)))>0 then

		      msgbox "宽度和小数只能为空!"
			 
    	   end if

           cancle=false
		   exit sub

		     elseif rtrim(new_value)="char"  then
			 
		    	if len(trim(grid1.columns.item(4)))>0 then

		           msgbox "小数只能为空!"
			 
    		     end if
             cancle=false
			 exit sub

			 elseif rtrim(new_value)="decimal" then
              

			 
			 exit sub

          else

	        msgbox "数据类型输入错误,请重新输入!"
     
	     cancle=true
		 exit sub   

	  end if

     
     case 3

	 if rtrim(grid1.columns.item(2))="int" or rtrim(grid1.columns.item(2))="bit" or rtrim(grid1.columns.item(2))="datetime" then
	   
	   if len(trim(new_value))>0 then
	      

	    msgbox "因为此记录的类型是int、bit和datetime其中的一个,所以宽度不需要录入!"
        
        cancle=true
        exit sub
	   end if

	 end if
    
	 if rtrim(grid1.columns.item(2))="char" or rtrim(grid1.columns.item(2))="decimal" then
   
       if len(trim(new_value))=0 or rtrim(new_value)="0"   then

         msgbox "因为此记录的类型是char和decimal中的一个,所以宽度不能为空,必须大于0 !"
         
		 cancle=true
         
		 exit sub

	   end if

     end if
    
	 case 4

	 if rtrim(grid1.columns.item(2))="decimal" and len(trim(new_value))=0 then
     
	    'if len(trim(new_value))=0 then

         msgbox "小数不能为空!"
         
		 cancle=true
		 
		 exit sub          

       ' end if    
			
		elseif  rtrim(grid1.columns.item(2))="decimal" and rtrim(grid1.columns.item(3))="1" then

	      if rtrim(new_value)>"1" then
		 
		    msgbox "或者小数列只能为0 !"

          end if

		elseif rtrim(grid1.columns.item(2))="decimal" and rtrim(grid1.columns.item(3))>"1" then

          if rtrim(new_value)>rtrim(grid1.columns.item(3)) or rtrim(new_value)=rtrim(grid1.columns.item(3)) then  
          
		   msgbox "小数不能等于宽度或不能大于宽度!"
          
		  end if
   
     end if
	
	end select
END sub
    
	 


sub recorddelete()

     l_ok = msgbox("你真的要删除此项目吗!",1,"提示")
   
    
 
   if l_ok  = 1 then
    
      if ltrim(rtrim(grid1.columns.item(1)))="学号" or ltrim(rtrim(grid1.columns.item(1)))="班号" or ltrim(rtrim(grid1.columns.item(1)))="姓名" then

	     msgbox "对不起! 基本项目不能删除!"

		 exit sub

⌨️ 快捷键说明

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