<!--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
%>
'Classic ASP' 카테고리의 다른 글
request body json data parsing (1) | 2023.11.01 |
---|---|
Baisc Auth (0) | 2023.11.01 |
파일 복사 (0) | 2016.11.08 |
스케쥴러 (0) | 2016.09.23 |
숫자 관련 추가 함수 (0) | 2016.06.27 |