90 people like it.

get the list of LAN Sql servers

get the list of ethernet sql servers

1: 
2: 
3: 
4: 
5: 
6: 
7: 
let getActiveSQLServers() =
        [for serv in Sql.SqlDataSourceEnumerator.Instance.GetDataSources().Rows ->
            if System.DBNull.Value.Equals(serv.["InstanceName"]) then
                serv.["ServerName"] :?> string
            else
                ( serv.["ServerName"] :?> string + "\\" 
                    + (serv.["InstanceName"] :?> string) ) ].ToList()
val getActiveSQLServers : unit -> 'a

Full name: Script.getActiveSQLServers
val serv : 'a
namespace System
type DBNull =
  member GetObjectData : info:SerializationInfo * context:StreamingContext -> unit
  member GetTypeCode : unit -> TypeCode
  member ToString : unit -> string + 1 overload
  static val Value : DBNull

Full name: System.DBNull
field System.DBNull.Value
System.Object.Equals(obj: obj) : bool
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string
Raw view Test code New version

More information

Link:http://fssnip.net/2C
Posted:13 years ago
Author:nCdy
Tags: sql server