I have the following code where I make an copy of my database that I use. the code executes 100% but the problem I have is I'm not able to access my database afterward.I get a "Cannot start your application. The workgroup information file is missing or opened exclusively by another user." and so if I restart the application it all works fine again.
我有以下代码,我在其中制作了我使用的数据库的副本。代码执行100%,但我遇到的问题是我之后无法访问我的数据库。我得到一个“无法启动您的应用程序。工作组信息文件丢失或由其他用户独占打开。”因此,如果我重新启动应用程序,它一切正常。
I'm certain the reason is because I can only access that database using a specific account name and password which is not account I'm logged in with.
我确定原因是因为我只能使用特定的帐户名和密码访问该数据库,而该帐户名和密码不是我登录的帐户。
What i want to try is to default that database mdb to the point where no user is accessing it, or to reassign the the only account name that can access it to that database mdb.
我想要尝试的是将数据库mdb默认为没有用户访问它的位置,或者重新分配可以访问该数据库mdb的唯一帐户名。
Any ideas, will be enormously appreciated? I've tried playing around with file security but had no luck.
任何想法,都会受到极大的赞赏吗?我试过玩文件安全但没有运气。
Private Sub cmdBackup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBackup.Click
BackupDialogDB.DefaultExt = ".mdb"
BackupDialogDB.InitialDirectory = "c:\"
'SaveFileDialog1.ShowDialog()
If BackupDialogDB.ShowDialog() = Windows.Forms.DialogResult.OK Then
Try
Dim sDBFile As String = Application.StartupPath + "\VFMS_DB.mdb"
Dim sBackUpFile As String = BackupDialogDB.FileName
'First check the file u want to compact exists or not
If File.Exists(sDBFile) Then
If Not File.Exists(sBackUpFile) Then
File.Copy(sDBFile, sBackUpFile)
Else
File.Delete(sBackUpFile)
File.Copy(sDBFile, sBackUpFile)
End If
MessageBox.Show("The database was successfully backedup to: " + sBackUpFile , "Database Backedup", MessageBoxButtons.OK, MessageBoxIcon.Information)
sDBFile = ""
Else
MessageBox.Show("There is no database to backup. Please restore from a backup", "Database Backup Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
3 个解决方案
#2
Do you have write permission in the target directory? Access needs to create a .ldb file along side the .mdb.
你在目标目录中有写权限吗? Access需要在.mdb旁边创建一个.ldb文件。
Otherwise, you can try some of the stuff here: http://www.xlinesoft.com/asprunnerpro/docs/error_the_microsoft_jet_database_engine_cannot%20open%20the%20file%20(unknown).htm
否则,你可以尝试一些这里的东西:http://www.xlinesoft.com/asprunnerpro/docs/error_the_microsoft_jet_database_engine_cannot%20open%20the%20file%20(unknown).htm
#3
Was the Database open when you copied it? Access creates lock files, *.ldb in the same directory the database is in, you might want to check for that file before you copy the database.
复制数据库时数据库是否打开? Access在数据库所在的同一目录中创建锁定文件* .ldb,您可能希望在复制数据库之前检查该文件。
#1
You should also copy and/or restore the workgroup information file.
您还应该复制和/或还原工作组信息文件。
#2
Do you have write permission in the target directory? Access needs to create a .ldb file along side the .mdb.
你在目标目录中有写权限吗? Access需要在.mdb旁边创建一个.ldb文件。
Otherwise, you can try some of the stuff here: http://www.xlinesoft.com/asprunnerpro/docs/error_the_microsoft_jet_database_engine_cannot%20open%20the%20file%20(unknown).htm
否则,你可以尝试一些这里的东西:http://www.xlinesoft.com/asprunnerpro/docs/error_the_microsoft_jet_database_engine_cannot%20open%20the%20file%20(unknown).htm
#3
Was the Database open when you copied it? Access creates lock files, *.ldb in the same directory the database is in, you might want to check for that file before you copy the database.
复制数据库时数据库是否打开? Access在数据库所在的同一目录中创建锁定文件* .ldb,您可能希望在复制数据库之前检查该文件。