如何一个系统,登陆时,不同客户通过机构代码实现链接不同数据库?老师我现在自己建立的登陆窗口,加载时都要卸载和重新装载表,这样去更换数据源。导致登陆很慢,并且网络有不稳定,报错概率很大。
老师,能否实现客户端登陆一次后保存此次登陆的数据链接字符串。
下次直接登陆了
把登录后的链接字符串保存到一个文本文件里。每次登录前先读取这个文本文件有没有链接字符串,如果有就直接使用,没有再让用户选择
老师我在BeforeConnectOuterDataSource写的如下代码,并建立了对应的文本文件,建立文本是也做了对应加密处理,为啥登陆后还是链接的老的数据源,
Dim ipFile As String = e.ProjectPath & "project\CplicationPathlog.txt"
If e.Name = "olddate" Then
If Filesys.FileExists(ipFile) Then
Dim Val As String = FileSys.ReadAllText(ipFile)
Dim ip As String = DecryptText(Val, "y14", "ww#") '解密
e.ConnectionString = ip
MessageBox.Show(ip) '而且打开发布后的软件并未弹出消息
End If
End If
调试
Dim ipFile As String = e.ProjectPath & "project\CplicationPathlog.txt"
msgbox(e.Name) ‘数据源名称正确吗
If e.Name = "olddate" Then
If Filesys.FileExists(ipFile) Then
msgbox(1) '能不能弹出
Dim Val As String = FileSys.ReadAllText(ipFile)
msgbox(Val )
Dim ip As String = DecryptText(Val, "y14", "ww#") '解密
e.ConnectionString = ip
MessageBox.Show(ip) '而且打开发布后的软件并未弹出消息
End If
End If
Dim ipFile As String = e.ProjectPath & "project\CplicationPathlog.txt"改为
Dim ipFile As String = e.ProjectPath & "CplicationPathlog.txt"