在一台机器上创建了4个数据库(access2003):data1,data2,data3,data4,数据全部加密,密码都是todata,放在项目文件里面DataResource文件夹下面,数据源名称分别为DataResourceData1,DataResourceData2,DataResourceData3,DataResourceData4
我希望打开项目后能全部加载这4个数据源
BeforeConnectOuterDataSource事件:
Dim DataResourceDirectory As String = e.ProjectPath & "DataResource"
If FileSys.DirectoryExists(DataResourceDirectory) Then
Dim DataResourceFile1 As String = e.ProjectPath & "DataResource\Data1.mdb"
Dim DataResourceFile2 As String = e.ProjectPath & "DataResource\Data2.mdb"
Dim DataResourceFile3 As String = e.ProjectPath & "DataResource\Data3.mdb"
Dim DataResourceFile4 As String = e.ProjectPath & "DataResource\Data4.mdb"
If FileSys.FileExists(DataResourceFile1) Then
CompactAccessFile(DataResourceFile1,"todata")
If e.Name = "DataResourceData1" Then
e.C& e.ProjectPath & _
"DataResource\data1.mdb;Persist Security Info=False;Jet OLEDB:Database Password=todata"
End If
End If
If FileSys.FileExists(DataResourceFile2) Then
CompactAccessFile(DataResourceFile2,"todata")
If e.Name = "DataResourceData2" Then
e.C& e.ProjectPath & _
"DataResource\data2.mdb;Persist Security Info=False;Jet OLEDB:Database Password=todata"
End If
End If
If FileSys.FileExists(DataResourceFile3) Then
CompactAccessFile(DataResourceFile3,"todata")
If e.Name = "DataResourceData3" Then
e.C& e.ProjectPath & _
"DataResource\data3.mdb;Persist Security Info=False;Jet OLEDB:Database Password=todata"
End If
End If
If FileSys.FileExists(DataResourceFile4) Then
CompactAccessFile(DataResourceFile4,"todata")
If e.Name = "DataResourceData4" Then
e.C& e.ProjectPath & _
"DataResource\data4.mdb;Persist Security Info=False;Jet OLEDB:Database Password=todata"
End If
End If
End If
项目在这台机器上运行正常
当把这个各项目拷贝到另一台也可使用开发版的机器上(未安装access )运行时,出现以下错误:
创建外部连接“DataResourceData1"失败,请联系管理员或开发者,重新设置数据连接字符串
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\foxtable\DevelopingProject\人事管理系统\DataResource\data1.mdb;Persist Security Info=False;Jet OLEDB:Database Password=todata
请问是什么原因,怎么解决呢?