参照帮助 在BeforeConnectOuterDataSource事件中 写入以下代码If e.name =
"eaerp"
Then
e.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
& e.ProjectPath &
"eaerp.mdb;Persist Security
Info=False"
End
if
发布项目以后 并不能实现这个项目复制到任何目录都能正常链接该外部数据源 每次打开都是提示外部数据源连接错误
但是放入代码
If e.Name =
"eaerp"
Then
Dim dlg As New OpenFileDialog
dlg.Filter= "Access文件|*.mdb"
If dlg.ShowDialog = DialogResult.Ok Then
e.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
dlg.FileName & ";Persist Security
Info=False"
End
If
End
if
能弹出对话框 查找数据库