01.
<SCRIPT language=VbScript>
02.
03.
top.OutputFrame.document.open()
04.
05.
function fncSql()
06.
07.
top.OutputFrame.document.open()
08.
09.
Set
cn = CreateObject(
"ADODB.Connection"
)
10.
strConnection =
"Provider=Microsoft.Jet.OLEDB.4.0;"
& _
11.
"Data Source="
& document.all.item(
"FILE"
).value &
";"
& _
12.
"Extended Properties="
"Excel 8.0;"
""
13.
14.
cn.Open strConnection
15.
16.
Set
rs = CreateObject(
"ADODB.Recordset"
)
17.
18.
SqlQuery = document.all.item(
"SQL"
).value
19.
rs.Open SqlQuery, cn
20.
21.
top.OutputFrame.document.write(
"<HTML><HEAD>"
)
22.
top.OutputFrame.document.write(
"<META HTTP-EQUIV="
"Content-Type"
" CONTENT="
"text/html; CHARSET=shift_jis"
">"
)
23.
top.OutputFrame.document.write(
"</HEAD><BODY>"
& vbCrLf )
24.
top.OutputFrame.document.write(
"<table cellpadding=5>"
)
25.
Do
while not rs.EOF
26.
27.
top.OutputFrame.document.write(
"<tr>"
& vbCrLf )
28.
29.
for i = 1 to rs.fields.count
30.
top.OutputFrame.document.write(
"<td>"
)
31.
top.OutputFrame.document.write( rs.Fields( i-1 ).Value )
32.
top.OutputFrame.document.write(
"</td>"
)
33.
Next
34.
35.
top.OutputFrame.document.write(
"</tr>"
& vbCrLf )
36.
37.
rs.MoveNext
38.
Loop
39.
top.OutputFrame.document.write(
"</table>"
& vbCrLf )
40.
top.OutputFrame.document.write(
"</BODY><HTML>"
)
41.
42.
rs.Close
43.
cn.Close
44.
45.
46.
47.
end function
48.
49.
</SCRIPT>