AfterOpenProject
'''
Dim s As String = FileSys.ReadAllText(ProjectPath & "Attachments\SqlServers.txt")
msgbox(s)
Dim arr() As String = s.Replace(vbcr,"").Split(vblf)
msgbox(arr.length)
For i As Integer = 0 To 1
Dim sql0 As new ftpclient
msgbox(arr(i*3))
msgbox(arr(i*3+1))
msgbox(arr(i*3+2))
sql0.Password=arr(i*3).Split("=")(1)
msgbox(arr(i*3).Split("=")(1))
sql0.Account = arr(i*3+1).Split("=")(1)
msgbox(arr(i*3+1).Split("=")(1))
sql0.host = arr(i*3+2).Split("=")(1)
msgbox(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
msgbox(lts)
If Connections.TryConnect(lts) = True Then
MessageBox.Show("数据源已经连通!")
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
现在经过修改不报错,但是感觉别扭
Dim sql0 As new ftpclient
msgbox(arr(i*3))
msgbox(arr(i*3+1))
msgbox(arr(i*3+2))
sql0.Password=arr(i*3).Split("=")(1)
msgbox(arr(i*3).Split("=")(1))
sql0.Account = arr(i*3+1).Split("=")(1)
msgbox(arr(i*3+1).Split("=")(1))
sql0.host = arr(i*3+2).Split("=")(1)
msgbox(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
msgbox(lts)
因为它是SQL,不是FTP,不知道怎么改