Hi all
I have some C# code which uses SMO but on my machine dt.Rows.Count is zero.
Could somebody please test this out and see if it works for them (perhaps it is
not working for me because I am connected via VPN?). Many thanks
Paul Newton
using System;
using System.Data;
using Microsoft.SqlServer.Management.Smo;
namespace EnumAvailableSqlServers
{
class Program
{
static void Main(string[] args)
{
DataTable dt = SmoApplication.EnumAvailableSqlServers(true);
Console.WriteLine(dt.Rows.Count);
foreach (DataRow dr in dt.Rows)
{
Console.WriteLine(dr["Name"]);
Console.WriteLine(" " + dr["Server"]);
Console.WriteLine(" " + dr["Instance"]);
Console.WriteLine(" " + dr["Version"]);
Console.WriteLine(" " + dr["IsLocal"]);
}
Console.WriteLine("Finished ...");
Console.ReadKey();
}
}
}
-----Original Message-----
From: ProfoxTech <[email protected]> On Behalf Of Alan Bourke
Sent: 30 April 2020 08:57
To: [email protected]
Subject: Re: SQL Server Shared Management Objects (SMO)
Sent by an external sender
------------------------------
Paul
There is no COM interface to SQL-SMO, so you would have to create a .NET
assembly with a COM-callable wrapper exposing the functions you want I think.
Or even just a .NET EXE which dumps any results to a text file that the vfp
SIDE CAN READ.
--
Alan Bourke
alanpbourke (at) fastmail (dot) fm
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message:
https://leafe.com/archives/byMID/sn1pr02mb374359959e97124e53d0b158a1...@sn1pr02mb3743.namprd02.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.