ASP 엑셀 문서 DB 저장
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library"
FILE="C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll" -->
<%
dim sConn
Set sConn = Nothing
set sConn = Server.CreateObject("ADODB.Connection")
sConn.open "Provider=SQLOLEDB; Data Source=DB주소; Initial Catalog=DBa명; User Id=아이디; Password=비번"
Dim xlsxFile
Dim SheetNamez
Dim xlsxConn
Dim strSQL
xlsxFile = "파일경로"
Set xlsxConn = Server.CreateObject("ADODB.Connection")
xlsxConn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & xlsxFile & "; Extended Properties=Excel 12.0;"
Set Rs = Server.CreateObject("ADODB.Recordset")
Set rsData = Server.CreateObject("ADODB.Recordset")
SheetName = "시트명"
strSQL = "SELECT * FROM [" & SheetName & "$]"
i = 1
Rs.Open strSQL, xlsxConn, 1, , 1
Do Until Rs.EOF
if i > 3 then ' 행은 1부터 시작
rsData.open "테이블명", sConn, 1, 2, adCmdTable
rsData.addnew
rsData("컬럼1") = trim(Rs(0)) ' 열은 0부터 시작
rsData("컬럼2") = trim(Rs(1))
rsData("컬럼3") = now()
rsData.update
rsData.close
end if
i = i + 1
Rs.MoveNext
Loop
Rs.Close
Set rsData = Nothing
Set Rs = Nothing
Set xlsxConn = Nothing
sConn.Close
set sConn = Nothing
%>
'Server Side > ASP' 카테고리의 다른 글
[ASP] Rnd 함수 (랜덤한 문자 조합 만들기) (0) | 2017.01.06 |
---|---|
ASP - MSSQL 날짜 검색 쿼리 (convert 미사용/사용) (0) | 2016.12.14 |
ASP <-> JSON 파서 (0) | 2016.12.11 |
ASP string 처리 (0) | 2016.12.02 |
ASP <-> PHP 상호 관련 레퍼런스 (0) | 2016.11.05 |