<%
'######The following is a class file, and the following annotation is the method of calling the class###################################################################################################################################################################################################################################
'#Note: If the system does not support the creation of Scripting.FileSystemObject object, the database compression function will not be used.
'#Access Database Class
'#CreateDbFile creates an Access database file
'#CompactDatabase compresses an Access database file
'#Create object method:
'#Seta=NewDatabaseTools
'#by(Xiao Hanxue)sf
'#########################################################################################
ClassDatabaseTools
PublicfunctionCreateDBfile(byValdbFileName, byValDbVer, byValSavePath)
'Create a database file
'IfDbVeris0ThenCreateAccess97dbFile
'IfDbVeris1ThenCreateAccess2000dbFile
OnerrorresumeNext
IfRight(SavePath,1)<>"/"orRight(SavePath,1)<>"/"ThenSavePath=Trim(SavePath)&"/"
IfLeft(dbFileName,1)="/"orLeft(dbFileName,1)="/"ThendbFileName=Trim(Mid(dbFileName,2,Len(dbFileName)))
IfDbExists(SavePath&dbFileName)Then
Response.Write("Sorry, this database already exists!")
CreateDBfile=False
Else
DimCa
SetCa=Server.CreateObject("ADOX.Catalog")
IfErr.number<>0Then
Response.Write("Cannot be established, please check for error message
"&Err.number&"
"&Err.Description)
Err.Clear
Exitfunction
EndIf
IfDbVer=0Then
callCa.Create("Provider=Microsoft.Jet.OLEDB.3.51;DataSource="&SavePath&dbFileName)
Else
callCa.Create("Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&SavePath&dbFileName)
EndIf
SetCa=Nothing
CreateDBfile=True
EndIf
Endfunction
PublicfunctionCompactDatabase(byValdbFileName,byValDbVer,byValSavePath)
'Compress database files
'0 for access97
'1 is access2000
OnErrorresumenext
IfRight(SavePath,1)<>"/"orRight(SavePath,1)<>"/"ThenSavePath=Trim(SavePath)&"/"
IfLeft(dbFileName,1)="/"orLeft(dbFileName,1)="/"ThendbFileName=Trim(Mid(dbFileName,2,Len(dbFileName)))
IfDbExists(SavePath&dbFileName)Then