'''
Dim s As String = FileSys.ReadAllText(ProjectPath & "Attachments\SqlServers.txt")
Dim arr() As String = s.Replace(vbcr,"").Split(vblf)
For i As Integer = 0 To 1
Dim sql0 As new ftpclient
sql0.Password=arr(i*3).Split("=")(1)
sql0.Account = arr(i*3+1).Split("=")(1)
sql0.host = arr(i*3+2).Split("=")(1)
Dim lts As String = "Provider=SQLOLEDB.1;Password="+sql0.Password+";Persist Security Info=True;User ID="+sql0.Account+";Initial Catalog=bydata;Data Source="+sql0.host
If Connections.TryConnect(lts) = True Then
For iy As Integer = 1 To 1
Connections.Add("用户",lts)
Next
Forms("用户登录").Open()
If _UserName = "" Then
Syscmd.Project.Exit()
Return '这个要加上,因为既然要退出,就不应该再执行后面的初始化代码了,否则会出错
End If
Exit For
Else
MessageBox.Show("数据源无法连通!")
End If
Next
这个代码可用,但是感觉有点别扭,请问用什么方法,改得顺眼点