紧凑型修复工作来自msaccess应用程序,但不是来自VB.NET [英] Compact & repair works from msaccess app, but not from VB.NET
问题描述
我一直面临着Compact& amp;从vb.NEt应用程序调用修复。
没有报告错误,但它无法解决问题。
然而,如果我在MSAccess中打开相同的mdb文件并修复它,它的工作原理!
我的尝试:
下面是我试过的代码:
方法1:
Dim JRO As New JRO.JetEngine
JRO.CompactDatabase(Provider = Microsoft。 Jet.OLEDB.4.0;&Data Source =&C:\ tempDB.mdb,
Provider = Microsoft.Jet.OLEDB.4.0;&Data Source =& ; mdwfilename&; Jet OLEDB:Engine Type = 5)
方法2:
Dim app As New Microsoft.Office.Interop.Access.Application
Dim tempFile As String =C:\ tempDB.mdb
app.CompactRepair(mdwfilename,tempFile,False)
app.Visible = False
Dim temp As FileInfo =新FileInfo(tempFile)
temp.CopyTo(mdwfilename,True)
temp.Delete()
I've been facing issues with Compact & Repair being called from vb.NEt application. 这篇关于紧凑型修复工作来自msaccess应用程序,但不是来自VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
No errors reported, but it doesn't fix the problem.
Whereas if I open the same mdb file in MSAccess and repair it, it works!
What I have tried:
Below is the code I tried:
Method1:
Dim JRO As New JRO.JetEngine
JRO.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source= " & "C:\tempDB.mdb",
"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & mdwfilename & ";Jet OLEDB:Engine Type=5")
Method2:
Dim app As New Microsoft.Office.Interop.Access.Application
Dim tempFile As String = "C:\tempDB.mdb"
app.CompactRepair(mdwfilename, tempFile, False)
app.Visible = False
Dim temp As FileInfo = New FileInfo(tempFile)
temp.CopyTo(mdwfilename, True)
temp.Delete()
Try a "sub-folder"; some operations cannot be carried out in the "root folder" of the boot disk.