请问老师:
我在项目文件所在目录下建了一个IP.txt文件,内容为外部数制源的路径(\\Drc-pc\gcjl\Data\GcJLData.mdb),发布时在添加附件中将此IP.txt文件添加了,发布后在本机上首次运行时会打开一个文件对话框让选数据源,第二次打开后就能正常进入。但在其它机子上打开时每次会打开一个打开文件对话框让选数据源。检查时publish\project\下面也有IP.txt,到底是什么原因?
在BeforeConnectOuterDataSource事件中的代码如下:
Dim ipfile As String = projectpath & "ip.txt"
If filesys.FileExists(ipfile) = True Then
Dim dbfile As String = filesys.ReadAllText(ipfile)
If filesys.FileExists(dbfile) = True Then
If e.name ="Access" Then
e.C & dbfile & ";Persist Security Info=False"
End If
If e.name ="Access" Then
Dim dlg As new OpenFileDialog
dlg.Filter = "Access文件|*.mdb"
If dlg.ShowDialog = DialogResult.OK Then
e.C & dlg.filename & ";Persist Security Info=False"
filesys.WriteAllText(ipfile,dlg.filename,False)
End If
End If
End If
Else
If e.name = "Access" Then
Dim dlg As new OpenFileDialog
dlg.Filter = "Access文件|*.mdb"
If dlg.ShowDialog = DialogResult.OK Then
e.C & dlg.filename & ";Persist Security Info=False"
filesys.WriteAllText(ipfile,dlg.filename,False)
End If
End If
End If