<% OPTION Explicit
Sub CheckxLDriver () ON Error ResMe Next
DIM VCONNSTRING DIM OCONN, OERR
'try to connect to file Nul: vconnstring =' driver = {Microsoft Excel Driver (* .xls)}; dbq = NUL: '
Set Oconn = CreateObject ('AdoDb.Connection') Oconn.open vconnstring
For Each Oerr in Oconn.errors 'When The Excel Driver Reports' Failure Creating File ',' Ten It Must Be Installed and Working ;-)) f err.nativeError = -5036 THEN EXIT SUB End If Next
RESPONSE.WRITE 'Provider or Driver NOT AVAILABLE. (RE-) Install MDAC.
'
Response.Write Hex & '' & Err.Description & 'FOR Each Oerr in Oconn.erroRors Response.write HEX (Oerr.Number) &' '& Oerr.nativeError &' '& Oerr.Description & '' Next Response.end
End Sub
Function getConnection (vconnstring) on Error ResMe Next
Set getConnection = Server.createObject ('adoDb.connection') getConnection.Open vconnstring
If Err.Number <> 0 THEN SET GETCONNECTION = Nothing endiff
END FUNCTION
Function OptionTag (Vchoice, Vtrue) DIM VSELECTED
IF vtrue life vselected = 'SELECTED' END IF
OptionTag = '
END FUNCTION
Function ischecked (vtrue) if vtrue kilnecked = '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 (Vserveerfolder)
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 ResMe Next
'from oledbvbc.inc const db_e_errorsincommand = & h80040e14
Dim Ors, Ofield Dim vthtag, Vthendtag
IF vxlhasheadings the vthtag = '
DataTable = '