PublicfunctionDbExists (byValdbPath) to check whether the database file contains metadata. CreateObject (ADODB. Connection) c. OpenProviderMicrosoft. Jet. OLEDB.4.0; DataSourcedbPathIfErr. number0ThenErr. ClearDbExistsf
Public function DbExists (byVal dbPath) to check whether the database file exists On Error resume Next Dim c Set c = Server. createObject (ADODB. connection) c. open Provider = Microsoft. jet. OLEDB.4.0; Data Source = dbPath If Err. number0 Then Err. clear DbExists = f
Public function DbExists (byVal dbPath)
'LookupDatabaseWhether the file exists
On Error resume Next
Dim c
Set c = Server. CreateObject ("ADODB. Connection ")
C. Open "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & dbPath
If Err. number <> 0 Then
Err. Clear
DbExists = false
Else
DbExists = True
End If
Set c = nothing
End function
Public function AppPath ()
'Get the current real path
AppPath = Server. MapPath ("./")
End function
Public function AppName ()
'Get the name of the current program
AppName = Mid (Request. serverVariables ("SCRIPT_NAME"), (Request. serverVariables ("SCRIPT_NAME"), "/",-1, 1) + 1, Len (Request. serverVariables ("SCRIPT_NAME ")))
End Function
Public function DeleteFile (filespec)
'Delete an object
Dim fso
Set fso = CreateObject ("Scripting. FileSystemObject ")
If Err. number <> 0 Then
Response. Write ("An error occurred while deleting the file! View error information
"& Err. number &"
"& Err. Description)
Err. Clear
DeleteFile = False
End If
Call fso. DeleteFile (filespec)
Set fso = Nothing
DeleteFile = True
End function
Public function RenameFile (filespec1, filespec2)
'Modify an object
Dim fso
Set fso = CreateObject ("Scripting. FileSystemObject ")
If Err. number <> 0 Then
Response. Write ("An error occurred while modifying the file name! View error information
"& Err. number &"
"& Err. Description)
Err. Clear
RenameFile = False
End If
Call fso. CopyFile (filespec1, filespec2, True)
Call fso. DeleteFile (filespec1)
Set fso = Nothing
RenameFile = True
End function
End Class
%>