我改成这样处理,应该可以.
Public Shadows Function OrgLogin(ByVal e As RequestEventArgs, ByVal org As String, ByVal connName As String) As Boolean
Dim isopen As Boolean = False
If org > "" Then
Dim cmd As New SQLCommand
cmd.C
Dim dt As DataTable
cmd.CommandText = "Sele ct * Fro m 手机端IP Where 分院名称='" & org & "' And 链接 is not null"
dt = cmd.ExecuteReader
If dt.DataRows.Count > 0 Then
If Connections.TryConnect(dt.DataRows(0)("链接")) = True Then
Connections.Delete(connName)
Connections.Add(connName, dt.DataRows(0)("链接"))
isopen = True
Else
isopen = False
End If
End If
End If
Return isopen
End Function
Dim connNameID As String = System.Guid.NewGuid.ToString.Replace("-", Nothing)
Dim isopen As Boolean = myfun.OrgLogin(e, fy, connNameID)