http://k.daum.net/qna/view.html?qid=0FnyB
http://earlyadopters.tistory.com/13


<!-- #include virtual="/include/scmDB_open.asp" -->
<%
Server.ScriptTimeout=10000'-엑셀데이터의 원활한 처리를 위해 타임아웃 설정

dim sql, strPath, strName, mimetype, partnerCode, moneyDate, viewPrice, gName, orderCode, orderDate, amount, realPrice
dim aData, objFile

Set uploadform = Server.CreateObject("DEXT.FileUpload")
'--업로드컴포넌트를 이용해 엑셀파일을 받아오는 부분
strPath = "D:SCMdata"

uploadform.DefaultPath = strPath
strName = uploadform("excelFile").FileName
mimetype = uploadform("excelFile").MimeType

'--실제로 엑셀파일인지 알아보는 부분
If mimetype="application/vnd.ms-excel" or mimetype="application/octet-stream" Then 
objFile = uploadform("excelFile").Save
Else 
Set uploadform = Nothing
scm_conn.Close
set scm_conn=nothing
response.write "<script language='java-script'>"
response.write "alert('n엑셀파일만 등록가능합니다.');"
response.write "history.back();"
response.write "</script>"
End If 
Set uploadform = Nothing

Set objApp = Server.CreateObject("Excel.Application") '엑셀 객체 생성
set objWorkbooks = objApp.Workbooks 'WorkBooks 객체 생성
Set objWorkbook = objWorkbooks.Open(objFile) 'Excel 파일 Open
Set objWorksheet = objWorkbook.Worksheets(1) 'Worksheet 객체 생성
Set objRange = objWorksheet.UsedRange '사용된 영역 객체 생성

aData= objRange.value '사용된 영역의 값들을 2차원배열 aData로 넘김

on Error Resume Next
scm_conn.BeginTrans
For i=2 to uBound(aData, 1) ' 배열의 끝까지 행루프
orderCode=trim(aData(i,1))
orderDate=left(orderCode,4) &"-"& mid(orderCode,5,2) &"-"& mid(orderCode,7,2)

moneyDate=replace(trim(aData(i,8)),"(","")
moneyDate=replace(moneyDate,")","")
gName=replace(trim(aData(i,10)),"'","")
amount=trim(aData(i,11))
realPrice=replace(trim(aData(i,12)),",","")
viewPrice=realPrice/amount

sql="insert orderTemp(partnerCode,orderNumber,orderDate"
sql=sql &",transportNum,invoiceNum,corp_inNum"
sql=sql &",corp_inName,corp_inPartnerName"
sql=sql &",corp_inPartnerNum,moneyDate,productNumber"
sql=sql &",goodsNameOption,orderCount,unitCost"
sql=sql &",paymentWay,receiver,receivePostal"
sql=sql &",receiveAddress,receiverPhone1,receiverPhone2"
sql=sql &",requestMsg,giftMsg,orderer"
sql=sql &",ordererPhone1,ordererPhone2,corp_partnerName"
sql=sql &",returnPostal,returnAddress"
sql=sql &",returnPhone1,returnPhone2"
sql=sql &")"
sql=sql &" values('"& partnerCode &"','"& orderCode &"','"& orderDate &"'" '--제휴사코드,주문번호,주문일
sql=sql &",'"& trim(aData(i,2)) &"','"& trim(aData(i,3)) &"','"& trim(aData(i,4)) &"'" '--택배사번호,송장번호,협력사번호
sql=sql &",'"& trim(aData(i,5)) &"','"& trim(aData(i,6)) &"'" '--협력사명,업체명
sql=sql &",'"& trim(aData(i,7)) &"','"& moneyDate &"','"& trim(aData(i,9)) &"'" '--상점번호,입금완료일,상품코드
sql=sql &",'"& gName &"','"& amount &"','"& viewPrice &"'" '--상품명,수량,가격
sql=sql &",'"& trim(aData(i,13)) &"','"& trim(aData(i,14)) &"','"& trim(aData(i,15)) &"'" '--지불수단,받는사람,우편번호
sql=sql &",'"& trim(aData(i,16)) &"','"& trim(aData(i,17)) &"','"& trim(aData(i,18)) &"'" '--배송지,전화번호,핸드폰
sql=sql &",'"& trim(aData(i,19)) &"','"& trim(aData(i,20)) &"','"& trim(aData(i,22)) &"'" '--요구사항,선물메시지,주문자명
sql=sql &",'"& trim(aData(i,23)) &"','"& trim(aData(i,24)) &"','"& trim(aData(i,25)) &"'" '--주문자전화,주문자핸드폰,상점명
sql=sql &",'"& trim(aData(i,26)) &"','"& trim(aData(i,27)) &"'" '--반품지우편,반품주소
sql=sql &",'"& trim(aData(i,28)) &"','"& trim(aData(i,29)) &"'" '--반품담당 전화번호1,반품담당 전화번호2
sql=sql &")"

scm_conn.execute(sql)

If scm_conn.Errors.Count > 0 Then
scm_conn.RollbackTrans '실패 처리

Set objRange = Nothing
Set objWorksheet = Nothing
objWorkbook.Close
Set objWorkbook = Nothing
Set objWorkbokks = Nothing
Set objApp = Nothing

scm_conn.Close
set scm_conn=nothing

response.write "<script language='java-script'>"
response.write "alert('n입력도중 " & i & " 라인에서 오류가 발생했습니다.nn파일을 한번더 확인하고 업로드 하세요');"
response.write "history.back();"
response.write "</script>"
response.End
Else
scm_conn.CommitTrans '성공처리..
End If
next

Set objRange = Nothing
Set objWorksheet = Nothing
objWorkbook.Close
Set objWorkbook = Nothing
Set objWorkbokks = Nothing
Set objApp = Nothing
%>
<!-- #include virtual="/include/scmDB_close.asp" -->

+ Recent posts