48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
<%@ LANGUAGE="VBSCRIPT" CodePage=65001 %>
|
|
<!-- #include virtual = "include/JSON_2.0.4.asp" -->
|
|
<%
|
|
Response.charset="UTF-8"
|
|
|
|
Set xlDb = Server.CreateObject("ADODB.Connection")
|
|
Set oRs = Server.CreateObject("ADODB.RecordSet")
|
|
|
|
excelName = unescape(Request("excelName"))
|
|
FileName = "D:\TEMP\" & excelName
|
|
|
|
Dim r_cnt
|
|
Dim table_data
|
|
Dim json
|
|
Dim json_obj
|
|
|
|
connectString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & FileName & "; Extended Properties='Excel 12.0;HDR=YES;IMEX=1'"
|
|
xlDb.Open connectString
|
|
|
|
Query = " SELECT * FROM [Sheet1$] "
|
|
oRs.Open Query, xlDb, 1
|
|
|
|
redim table_data(oRs.RecordCount)
|
|
|
|
i = 0
|
|
Do while not oRs.EOF
|
|
i = i + 1
|
|
set json_obj = jsObject()
|
|
json_obj("No") = i
|
|
json_obj("n_name") = Trim(oRs.Fields(0).Value)
|
|
json_obj("n_birth") = Trim(oRs.Fields(1).Value)
|
|
json_obj("n_gubun") = Trim(oRs.Fields(2).Value)
|
|
json_obj("n_date") = Trim(oRs.Fields(3).Value)
|
|
json_obj("n_time") = Trim(oRs.Fields(4).Value)
|
|
json_obj("n_danga") = Trim(oRs.Fields(5).Value)
|
|
json_obj("n_etc") = Trim(oRs.Fields(6).Value)
|
|
set table_data(i) = json_obj
|
|
oRs.MoveNext
|
|
Loop
|
|
|
|
set json = jsOBject()
|
|
json("table_data") = table_data
|
|
|
|
Response.Write toJSON(json)
|
|
|
|
'Response.Write table_date
|
|
'Response.Write oRs.recordcount &"//"& oRs.Fields.count
|
|
%> |