upload.asp--------------------------------------
-------上傳並且寫入庫-----------
response.write "資料格式不對!"
response.write "返回"
response.end()
end if
set file=nothing
else
response.write "檔案不能為空!"
response.write "返回"
response.end()
end if
set upload=nothing
'上傳xls檔案結束,下面從上傳的xls檔案中讀取資料寫入到sql資料庫
set excelconn=server.createobject("adodb.connection")
excelconn.open "provider = microsoft.jet.oledb.4.0 ; data source = "+straddr+";extended properties='excel 8.0;hdr=no;imex=1'"
set rs=server.createobject("adodb.recordset")
set rs1=server.createobject("adodb.recordset")
sql="select * from [sheet1$]"
rs.open sql,excelconn,1,1
if not(rs.bof and rs.eof) then
rs.movenext
do while not rs.eof
sql1="select * from [fees_asse_t] where id is null"
rs1.open sql1,conn,1,3
rs1.addnew
rs1("cate_code")=rs(0)
rs1("asse_code")=rs(1)
rs1("asse_name")=rs(2)
rs1("categories")=rs(3)
rs1.update
rs1.close
rs.movenext
loop
end if
rs.close()
set rs=nothing
set rs1=nothing
excelconn.close()
set excelconn=nothing
conn.close()
set conn=nothing
%>
利用xlrd實現xls檔案匯入資料
coding utf 8 import os os.environ.setdefault django settings module www.settings django 版本大於等於1.7的時候,需要加上下面兩句 import django django.setup import django...
asp匯入EXEL文件
execl資料匯入title type text css body,td,th style head session.codepage 936 server.scripttimeout 600000 set upload new upload 5xsoft set file upload.file ...
匯入 ASP常用函式 FormatDate
function formatdate sdatetime,sreallydo dim sjorkin sjorkin getlocale if not isdate sdatetime then sdatetime now sdatetime cdate sdatetime select case...