试试:
If _WinName > "" AndAlso _MenuItemName > "" Then
Dim cmd As new SQLCommand
cmd.ConnectionName = _ServerName
cmd.CommandText = "select * from {平台管理} where [模块名称] = '" & _WinName & "' and [控件名称] = '" & _MenuItemName & "'"
Dim dt As DataTable = cmd.ExecuteReader()
If dt.DataRows.Count > 0 Then
If dt.DataRows(0)("对象名称") <> "" Then
If dt.DataRows(0)("是否启用") = True Then
Forms(dt.DataRows(0)("对象名称")).Open()
Else
Forms(_WinName).Controls(_MenuItemName).ShowToolTip("对象没有被启用!",3000)
End If
Else
Forms(_WinName).Controls(_MenuItemName).ShowToolTip("对象没有被注册!",3000)
End If
End If
End If