반응형
'initialize variables
Dim
objConn, strSQL
Dim
x
Set
objConn = Server.CreateObject(
"ADODB.Connection"
)
objConn.Open
"DRIVER={Microsoft Excel Driver (*.xls)}; IMEX=1; HDR=NO; "
&_
"Excel 8.0; DBQ="
& Server.MapPath(
"filename.xls"
) &
"; "
strSQL =
"SELECT * FROM A1:G1000"
Response.Write(
"<table border="
"1"
">"
)
Response.Write(
"<tr>"
)
'write all columnNames
For
x=0
To
objRS.Fields.Count-1
Response.Write(
"<th>"
& objRS.Fields(x).Name &
"</th>"
)
Next
Response.Write(
"</tr>"
)
Do
Until
objRS.EOF
' write as much columns as there are in your excel file
Response.Write(
"<td>"
& objRS.Fields(0).Value &
"</td>"
)
Response.Write(
"<td>"
& objRS.Fields(1).Value &
"</td>"
)
Response.Write(
"<td>"
& objRS.Fields(2).Value &
"</td>"
)
Response.Write(
"<td>"
& objRS.Fields(3).Value &
"</td>"
)
Response.Write(
"<td>"
& objRS.Fields(4).Value &
"</td>"
)
Response.Write(
"<td>"
& objRS.Fields(5).Value &
"</td>"
)
Response.Write(
"<td>"
& objRS.Fields(6).Value &
"</td>"
)
objRS.Close
Response.Write(
"</table>"
)
Set
objRS=
Nothing
반응형
'Developer > asp' 카테고리의 다른 글
aspjson read.. (0) | 2016.05.23 |
---|---|
asp User Function (0) | 2016.02.01 |
asp header 추가하기,Access-Control-Allow-Origin: * / 크로스도메인 / 브라우저 보안 (3) | 2015.04.02 |
http 와 https 간의 세견 공유 ,classic ASP (0) | 2015.03.23 |
Server2008 로 구 웹사이트 이전 절차 (0) | 2015.03.13 |