我正在尝试使用 vb.net 压缩我的数据库,但我不断收到错误消息
无法识别的数据库格式“C:\Forte\Fortedb.accdb”。
我环顾四周,没有找到任何可以帮助我的东西。这是我的代码
Private Sub Compactdb()
Dim JRO As JRO.JetEngine
JRO = New JRO.JetEngine
'The first source is the original, the second is the compacted database under another name.
JRO.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\Forte\Fortedb.accdb;", "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\Forte\Compactdb.accdb;")
'Original not compacted database is deleted
System.IO.File.Delete("C:\Forte\Fortedb.accdb")
'Compacted database is renamed to the original database's name.
Rename("C:\Forte\fortedb.accdb", "C:\forte\Compactdb.accdb")
'User notification
MsgBox("The database was compacted successfully")
End Sub