📄 inputexcel_index.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>陈利品的毕业设计</title>
<%
set newconn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
DBPath = Server.MapPath("#ctm wish.mdb")
newconn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
page = CLng(request("page")) '利用CLng函数把page值转换为Long型
judge=request("judge")
judge2=request("judge2")
judge3=0
sqlcmd="select * from student_info "
rs.Open sqlcmd,newconn,1,2
%>
<style type="text/css">
<!--
.style1 {font-size: 24px}
.style2 {font-size: 18px}
.style3 {font-size: 16px}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body>
<div id="Layer1" style="position:absolute; left:619px; top:48px; width:100px; height:30px; z-index:1" onClick="MM_goToURL('parent','index.asp');return document.MM_returnValue"><a href="index.asp">返回</a>主页</div>
<div align="center" class="style1">
<div align="center">
<p>导入excel数据到access数据库中<br>
<br>
</p>
</div>
</div>
<span class="style2">注意:请把本地的excel文件上传到服务器,excel文件请注意与数据库的结构保持一致,否则在导入数据过程中可能会出现类型不一致或者关键字段重复的错误</span><br>
<table border=1 cellPadding=0
cellSpacing=0 >
<% for i=0 to rs.fields.count-1%>
<td><%=rs(i).name%></td>
<%next%>
<%
if not (rs.EOF or rs.BOF) then
rs.MoveFirst
rs.PageSize = 6
If page < 1 Then page = 1
If page > rs.PageCount Then page = rs.PageCount
rs.AbsolutePage = page
'do while not rs.eof
For ipage = 1 To rs.PageSize%>
<tr>
<% for i=0 to rs.fields.count-1 %>
<td><%=rs(i)%></td>
<%next%>
</tr>
<%
rs.MoveNext
If rs.EOF Then Exit For
'loop
next
end if%>
</table>
<table width="100%" border="0" align="center" cellspacing="0">
<tr>
<td> 共有<font
color=red><%=rs.recordCount%> </font>条记录
页数:<font
color=red><%=page%> </font>/ <%=rs.PageCount%>
<%
If page = 1 Then
Response.Write "<font class='white'>第一页 上一页</font>"
End If
If page <> 1 Then
Response.Write "<a href=index.asp?page=1 class='yellow'>第一页</a>"
Response.Write " <a href=index.asp?page=" & (page - 1) & " class='yellow'>上一页</a>"
End If
If page <> RS.PageCount Then
Response.Write " <a href=index.asp?page=" & (page + 1) & " class='yellow'>下一页</a>"
Response.Write " <a href=index.asp?page=" & RS.PageCount & " class='yellow'>最后一页</a>"
End If
If page = RS.PageCount Then
Response.Write " <font class='white'>下一页 最后一页</font>"
End If
%></a>
到
<%Response.Write "<input type=text size=2 maxlength=4 name=page class=editbox1><input type=hidden name=judge value=1>" '显示输入页数框并将page,judge参数传递下去%>
页 </td>
</tr>
</table>
<br>
请在下面选择一个文件或者上传一个新文件<br>
<%
Class UpLoadClass
Private p_MaxSize,p_FileType,p_SavePath,p_AutoSave,p_Error
Private objForm,binForm,binItem,strDate,lngTime
Public FormItem,FileItem
Public Property Get Version
Version="Rumor UpLoadClass Version 2.0"
End Property
Public Property Get Error
Error=p_Error
End Property
Public Property Get MaxSize
MaxSize=p_MaxSize
End Property
Public Property Let MaxSize(lngSize)
if isNumeric(lngSize) then
p_MaxSize=clng(lngSize)
end if
End Property
Public Property Get FileType
FileType=p_FileType
End Property
Public Property Let FileType(strType)
p_FileType=strType
End Property
Public Property Get SavePath
SavePath=p_SavePath
End Property
Public Property Let SavePath(strPath)
p_SavePath=replace(strPath,chr(0),"")
End Property
Public Property Get AutoSave
AutoSave=p_AutoSave
End Property
Public Property Let AutoSave(byVal Flag)
select case Flag
case 0:
case 1:
case 2:
case false:Flag=2
case else:Flag=0
end select
p_AutoSave=Flag
End Property
Private Sub Class_Initialize
p_Error = -1
p_MaxSize = 153600
p_FileType = "jpg/gif"
p_SavePath = ""
p_AutoSave = 0
strDate = replace(cstr(Date()),"-","")
lngTime = clng(timer()*1000)
Set binForm = Server.CreateObject("ADODB.Stream")
Set binItem = Server.CreateObject("ADODB.Stream")
Set objForm = Server.CreateObject("Scripting.Dictionary")
objForm.CompareMode = 1
End Sub
Private Sub Class_Terminate
objForm.RemoveAll
Set objForm = nothing
Set binItem = nothing
binForm.Close()
Set binForm = nothing
End Sub
Public Sub Open()
if p_Error=-1 then
p_Error=0
else
Exit Sub
end if
Dim lngRequestSize,binRequestData,strFormItem,strFileItem
Const strSplit="'"">"
lngRequestSize=Request.TotalBytes
if lngRequestSize<1 then
p_Error=4
Exit Sub
end if
binRequestData=Request.BinaryRead(lngRequestSize)
binForm.Type = 1
binForm.Open
binForm.Write binRequestData
Dim bCrLf,strSeparator,intSeparator
bCrLf=ChrB(13)&ChrB(10)
intSeparator=InstrB(1,binRequestData,bCrLf)-1
strSeparator=LeftB(binRequestData,intSeparator)
Dim p_start,p_end,strItem,strInam,intTemp,strTemp
Dim strFtyp,strFnam,strFext,lngFsiz
p_start=intSeparator+2
Do
p_end =InStrB(p_start,binRequestData,bCrLf&bCrLf)+3
binItem.Type=1
binItem.Open
binForm.Position=p_start
binForm.CopyTo binItem,p_end-p_start
binItem.Position=0
binItem.Type=2
binItem.Charset="gb2312"
strItem=binItem.ReadText
binItem.Close()
p_start=p_end
p_end =InStrB(p_start,binRequestData,strSeparator)-1
binItem.Type=1
binItem.Open
binForm.Position=p_start
lngFsiz=p_end-p_start-2
binForm.CopyTo binItem,lngFsiz
intTemp=Instr(39,strItem,"""")
strInam=Mid(strItem,39,intTemp-39)
if Instr(intTemp,strItem,"filename=""")<>0 then
if not objForm.Exists(strInam&"_From") then
strFileItem=strFileItem&strSplit&strInam
if binItem.Size<>0 then
intTemp=intTemp+13
strFtyp=Mid(strItem,Instr(intTemp,strItem,"Content-Type: ")+14)
strTemp=Mid(strItem,intTemp,Instr(intTemp,strItem,"""")-intTemp)
intTemp=InstrRev(strTemp,"\")
strFnam=Mid(strTemp,intTemp+1)
objForm.Add strInam&"_Type",strFtyp
objForm.Add strInam&"_Name",strFnam
objForm.Add strInam&"_Path",Left(strTemp,intTemp)
objForm.Add strInam&"_Size",lngFsiz
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -