<!--#include file="../checkLogin.asp"-->
<!--#include file="../SQLconn.asp"-->
 <%
 
Set Upload=Server.createobject("Persits.Upload.1") 
uploadlimitsize=request.cookies("filelength")                             '改变这个设置可以改变上传文件的大小限制，单位兆。
Upload.SetMaxSize uploadlimitsize*1024*1024, True 
Upload.Save  
if err.number <> 0 then 
response.write  "出现错误: " & err.number & "、" & err.description &"" 
end if 
if err.number = 8 then 
response.write " 你上传的文件超过限制（"& uploadlimitsize &"兆）<a href=""javascript:history.go(-1)"">重新上传</a>" 
response.end 
end if 
   
   tname=request.cookies("tname")
   years=Upload.Form("years").value
   tongyibianhao=Upload.Form("tongyibianhao").value
   huajiangdate=Upload.Form("huajiangdate").value
   MingCheng=Upload.Form("MingCheng").value
   DengJi=Upload.Form("DengJi").value
   bumen=Upload.Form("bumen").value
   beizhu=Upload.Form("beizhu").value
   
   set FileObj1=Upload.Files("file1") 
   filename=FileObj1.FileName
   
        
		Set cmd = server.CreateObject("ADODB.Command")
		set Cmd.ActiveConnection = conn
		with Cmd
			   .CommandText = "incid"
			   .CommandType = 4
			   .parameters.Refresh
			   .parameters("@name") ="AllID"
			   .execute
			   picid = .parameters("@id")
		end with
		 

		dim Rsfilesql
		dim Rsstudent
		set Rsstudent=server.createobject("adodb.recordset")
		Rsstudentsql="select * from students where tongyibianhao='"&tongyibianhao&"'  and years='"&years&"'" 		
		Rsstudent.open Rsstudentsql,conn,1,3
		
		dim Rsfile
		set Rsfile=server.createobject("adodb.recordset")
		Rsfilesql="select * from stuHuoJiang where (id is null)" 		
		Rsfile.open Rsfilesql,conn,1,3
		Rsfile.addnew
		Rsfile("tongyibianhao")=tongyibianhao
		Rsfile("years")=Rsstudent("years")
		Rsfile("grade")=Rsstudent("grade")
		Rsfile("class")=Rsstudent("class")
		
		Rsfile("number")=Rsstudent("number")
		Rsfile("Uname")=Rsstudent("Uname")
		
		Rsfile("获奖时间")=huajiangdate
		Rsfile("获奖名称")=MingCheng
		Rsfile("获奖等级")=DengJi
		Rsfile("颁奖部门")=bumen
		
		Rsfile("备注")=beizhu
		Rsfile("填表人")=tname
		Rsfile("picid")=picid
		Rsfile.update
	
				
		
		sql="select * from stuHuoJiangFile where (id is null)"
		Set rs= Server.CreateObject("ADODB.Recordset")
		rs.open sql,conn,1,3
		rs.addnew 
		
		rs("picid")=picid
		rs("filename")=FileObj1.FileName
		rs("fileContentType")=FileObj1.ContentType
		rs("filevalue").appendchunk FileObj1.Binary
		rs("FileLength")= FormatNumber(FileObj1.Size/1024/1024,2)
		rs.update 
		rs.close 
		
		rsfile.close     
		Upload.Dispose ' 释放内存 
		Set Upload = Nothing 
	 
		response.redirect   "main.asp?years="&years&"&tongyibianhao="&tongyibianhao
  %>	


<%=tongyibianhao%>
<%=Rsstudent("years")%>
<br>
<%=NewID%>
