如图,外网服务器IP地址改变后造成无法连接服务器,在
BeforeConnectOuterDataSource
事件中输入代码
Dim
ipFile
As
String = e.ProjectPath
&
"ip.txt"
If e.Name = "数据源" Then
If Filesys.FileExists(ipFile) Then '判断文件存在
Dim ip As String = FileSys.ReadAllText(ipFile) '获取文件内容
e.ConnectionString = e.ConnectionString.Replace("120.0.0.10",ip)
If TryConnectHost(ip) Then
If Network.Ping(ip,1000) = False Then '如果第一个IP无法接通
MessageBox.Show("连接服务器失败!",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.HideSplashForm = True
endif
Else
MessageBox.Show("连接服务器失败!",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.HideSplashForm = True
endif
endif
endif
请教老师,怎么去掉图中的连接提示,用代码中的提示替换?
此主题相关图片如下:连接提示.jpg