Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should be able to do something like the following sample console app:</p> <pre><code> static void Main(string[] args) { using (SqlConnection conn = new SqlConnection(@"SAMPLE_CONNECTIONSTRING")) { conn.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = conn; cmd.CommandText = "SELECT * FROM SAMPLE_TABLE"; SqlDataReader dr = cmd.ExecuteReader(); //Used to show that values update based on connections in use. //dr.Dispose(); //cmd.Dispose(); //conn.Dispose(); //create our WMI searcher ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_PerfRawData_NETDataProviderforSqlServer_NETDataProviderforSqlServer"); //now loop through all the item found with the query foreach (ManagementObject obj in searcher.Get()) { try { Console.WriteLine("Class Win32_PerfRawData_NETDataProviderforSqlServer_NETDataProviderforSqlServer"); Console.WriteLine(obj.Properties["Name"].Value); Console.WriteLine("Connection Pools " + obj.Properties["NumberOfActiveConnectionPools"].Value); Console.WriteLine("Pooled Connections " + obj.Properties["NumberOfPooledConnections"].Value); Console.WriteLine("Active Connections " + obj.Properties["NumberOfActiveConnections"].Value); Console.WriteLine("Free Connections " + obj.Properties["NumberOfFreeConnections"].Value); } catch (Exception ex) { //throw new Exception("Failed to enumerate a WMI command.", ex); } } } } Console.ReadLine(); } </code></pre> <p><a href="http://www.activexperts.com/admin/scripts/wmi/vbscript/0615/" rel="nofollow">VB Code Sample that got me the correct Win32 class.</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload