Jump to content

Recommended Posts

Posted

Dim sDBFile As String = "E:\myDB.mdb"

Dim sBackUpFile As String = "E:\myDB_BackUp.mdb"

' Backup *.mdb database

If File.Exists(sDBFile) Then

Dim db As New DAO.DBEngine

'CompactDatabase has two parameters, creates a copy of compact DB at the Destination path

db.CompactDatabase(sDBFile, sBackUpFile)

End If

Posted

Boa Noite!

Fiz o teste e agora esta dando outro erro:

An unhandled exception of type 'System.StackOverflowException' occurred in Controle.exe

Segue o código.

Jetenginer.vb

Namespace JRO
Class JetEngine

Sub CompactDatabase(ByVal sDBFile As String, ByVal sBackUpFile As String)

Dim jro As JRO.JetEngine

jro = New JRO.JetEngine()

jro.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Projects\Visual Studio 2010\banco de dados.accdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\Projects\Visual Studio 2010\bancodedados.accdb;Jet OLEDB:Engine Type=5")

MsgBox("Finished Compacting Database!")
End Sub


End Class
End Namespace

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.