function ischecked(vtrue)
if vtrue then
ischecked = "checked"
end if
end function
function bookoptions(vxlfile)
dim vserverfolder
dim ofs, ofolder, ofile
dim vselected
vserverfolder = server.mappath(".")
set ofs = server.createobject("scripting.filesystemobject")
set ofolder = ofs.getfolder(vserverfolder)
for each ofile in ofolder.files
if ofile.type = "microsoft excel worksheet" then
vselected = (ofile.name = vxlfile)
bookoptions = bookoptions & _
optiontag(ofile.name, vselected)
end if
next
set ofolder = nothing
set ofs = nothing
end function
function namedrangeoptions(oconn, vxlrange, vtabletype)
dim oschemars
dim vselected
namedrangeoptions = optiontag(empty, empty)
if typename(oconn) = "connection" then
set oschemars = oconn.openschema(adschematables)
do while not oschemars.eof
if oschemars("table_type") = vtabletype then
vselected = (oschemars("table_name") = vxlrange)
namedrangeoptions = namedrangeoptions & _
optiontag(oschemars("table_name"), vselected)
end if
oschemars.movenext
loop
end if
end function
function datatable(oconn, vxlrange, vxlhasheadings)
on error resume next
const db_e_errorsincommand = &h80040e14
dim ors, ofield
dim vthtag, vthendtag
if vxlhasheadings then
vthtag = "<th>"
vthendtag = "</th>"
else
vthtag = "<td>"
vthendtag = "</td>"
end if
datatable = "<table border=1>"
if typename(oconn) = "connection" then
set ors = oconn.execute("[" & vxlrange & "]")
if oconn.errors.count > 0 then
for each oconnerr in oconn.errors
if oconnerr.number = db_e_errorsincommand then
datatable = datatable & _
"<tr><td>该范围不存在:</td><th>" & vxlrange & "</th></tr>"
else
datatable = datatable & _
"<tr><td>" & oconnerr.description & "</td></tr>"
end if
next
else
datatable = datatable & "<tr>"
for each ofield in ors.fields
datatable = datatable & vthtag & ofield.name & vthendtag
next
datatable = datatable & "</tr>"
do while not ors.eof
datatable = datatable & "<tr>"
for each ofield in ors.fields
datatable = datatable & "<td>" & ofield.value & "</td>"
next