- 添加引用 Microsoft Jet and Replication Objects 2.6 Library
- 使用以下代码:
read_con.Close() '压缩数据库 引用Microsoft Jet and Replication Objects 2.6 Library
If System.IO.File.Exists(“D:” & “temp.mdb”) Then
System.IO.File.Delete(“d:\temp.mdb”)
End If
Dim jro As JRO.JetEngine
jro = New JRO.JetEngine()
jro.CompactDatabase(ConnString, “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\temp.mdb;Jet OLEDB:Engine Type=5;Password=;”) 'User ID=Admin;
System.IO.File.Delete(System.Windows.Forms.Application.StartupPath & "\" & "sjfx.mdb")
System.IO.File.Move("d:\\temp.mdb", System.Windows.Forms.Application.StartupPath & "\" & "sjfx.mdb")