股指期货贴水

当前位置:错新网文章中心网站开发Asp → 压缩并修复Access数据库(推荐)

压缩并修复Access数据库(推荐)

减小字体 增大字体 作者:admin  来源:www.hack50.com  发布时间:2012-5-6 9:46:05
Compact and Repair


You can use the "Compact and Repair" function in Access from ASP code. The following code is an example of
how this can be done. Note that when you decide to "Compact and Repair" your Access database, some
autonumbers can be changed. Access makes all autonumbers consecutive.
This code uses one database, but I'm sure the code can easily be changed so that the listbox displays, for
example, all the databases in one folder.


<%

Const Jet_Conn_Partial = "Provider=Microsoft.Jet.OLEDB.4.0; Data source="
Dim strDatabase, strFolder, strFileName

'#################################################
'# Edit the following two lines
'# Define the full path to where your database is
strFolder = "F:\InetPub\wwwroot\_db\"
'# Enter the name of the database
strDatabase = "YourAccessDatabase.mdb"
'# Stop editing here
'##################################################

Private Sub dbCompact(strDBFileName)
Dim SourceConn
Dim DestConn
Dim oJetEngine
Dim oFSO

SourceConn = Jet_Conn_Partial & strFolder & strDatabase
DestConn = Jet_Conn_Partial & strFolder & "Temp" & strDatabase

Set oFSO = Server.CreateObject("scripting.FileSystemObject")
Set oJetEngine = Server.CreateObject("JRO.JetEngine")

With oFSO

If Not .FileExists(strFolder & strDatabase) Then
Response.Write ("Not Found: " & strFolder & strDatabase)
Stop
Else
If .FileExists(strFolder & "Temp" & strDatabase) Then
Response.Write ("Something went wrong last time " _
& "Deleting old database... Please try again")
.DeleteFile (strFolder & "Temp" & strDatabase)
End If
End If
End With

With oJetEngine
.CompactDatabase SourceConn, DestConn
End With

oFSO.DeleteFile strFolder & strDatabase
oFSO.MoveFile strFolder & "Temp" _
& strDatabase, strFolder& strDatabase

Set oFSO = Nothing
Set oJetEngine = Nothing
End Sub

Private Sub dbList()
Dim oFolders
Set oFolders = Server.CreateObject("scripting.FileSystemObject")
Response.Write ("<Select Name=""DBFileName"">")
For Each Item In oFolders.GetFolder(strFolder).Files
If LCase(Right(Item, 4)) = ".mdb" Then
Response.Write ("<Option Value=""" & Replace(Item, strFolder, "") _
& """>" & Replace(Item, strFolder, "") & "</Option>")
End If
Next
Response.Write ("</Select>")

Set oFolders = Nothing
End Sub


%>
<%
' Compact database and tell the user the database is optimized
Select Case Request.form("cmd")
Case "Compact"
dbCompact Request.form("DBFileName")
Response.Write ("Database " & Request.form("DBFileName") & " is optimized.")
End Select
%>

<p><font size="4">Compact and repair database</font></p>
<form method="POST" action="">
<p><%dbList%><input type="submit" value="Compact" name="cmd"></p>
</form>


本文引用网址:

在下列搜索引擎中搜索“压缩并修复Access数据库(推荐)”的相关信息:

谷歌搜索 百度搜索 雅虎搜索 搜狗搜索 搜搜搜索 必应搜索 有道搜索
你可能还喜欢以下文章
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1如何搭建第一个网站?做网站有...
  • 2网络红人如何赚钱?我要成为网...
  • 3说说"电视棒"为什么卖得这么火...
  • 4
  • 5怎么用微博赚钱?微博能赚钱吗...
  • 1中国女大学生的淫靡生活
  • 2嫩白少妇与猛男户外疯狂车震遭...
  • 3
  • 4情侣酒店激情性爱 上演限制级影...
  • 5偷拍男女练功房里的那点事 看后...
  • 1如何做服务器安全维护?有哪些...
  • 2Windows Server 2003 安全性指...
  • 3
  • 4
  • 5
    • ·上一篇文章:
    • ·下一篇文章:

    赞助商广告

    频道栏目配资平台

    热门文章导读

    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    图片文章导读

    股指期货贴水相关的文章阅览

    本类最新分享

    • 2012-05-06[Asp]
    • 2012-05-06[Asp]
    • 2012-05-06[Asp]
    • 2012-05-06[Asp]
    • 2012-05-06[Asp]
    • 2012-05-06[Asp]
    • 2012-05-06[Asp]
    • 2012-05-06[Asp]
    • 2012-05-06[Asp]
    • 2012-05-06[Asp]
    • 2012-05-06[Asp]
    • 2012-05-06[Asp]

    闽发证券股票开户

    周口网上炒股

    乌鲁木齐股票开户

    朔州网上炒股

    海通证券

    大连财政证券融资融券

    配资公司

    大连配资公司

    邢台炒股开户

    闽发证券

    崇左股票开户

    汕头证券网上开户网站

    营口网上炒股

    赢牛资管

    河源股票开户

    西南证券开户

    山东图木舒克炒股开户

    南宁配资开户

    陕西晋城炒股开户

    点点策略