Home > Database > Mysql Tutorial > 纯编码如何实现Access数据库的建立或压缩(3)

纯编码如何实现Access数据库的建立或压缩(3)

WBOY
Release: 2016-06-07 15:02:42
Original
1275 people have browsed it

Public function DbExists(byVal dbPath) 查找 数据库 文件是否存在 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)

  ’查找数据库文件是否存在

  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 = false

  else

  DbExists = True

  End If

  set c = nothing

  End function

  Public function AppPath()

  ’取当前真实路径

  AppPath = Server.MapPath("./")

  End function

  Public function AppName()

  ’取当前程序名称

  AppName = Mid(Request.ServerVariables("SCRIPT_NAME"),(InStrRev(Request.ServerVariables("SCRIPT_NAME") ,"/",-1,1))+1,Len(Request.ServerVariables("SCRIPT_NAME")))

  End Function

  Public function DeleteFile(filespec)

  ’删除一个文件

  Dim fso

  Set fso = CreateObject("Scripting.FileSystemObject")

  If Err.number0 Then

  Response.Write("删除文件发生错误!请查看错误信息
" & 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)

  ’修改一个文件

  Dim fso

  Set fso = CreateObject("Scripting.FileSystemObject")

  If Err.number0 Then

  Response.Write("修改文件名时发生错误!请查看错误信息
" & 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

  %>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template