How to create or compress an Access database using pure encoding (5)

Source: Internet
Author: User
Tags servervariables
EndfunctionPublicfunctionDbExists (byValdbPath) to check whether the database file contains metadata. CreateObject (ADODB. Connection) c. OpenProviderMicrosoft. Jet. OLEDB.4.0; DataSourcedbPathIfErr. number0ThenErr. Clear

End function 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

End function

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

%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.