Mega Code Archive

 
Categories / C# Tutorial / ADO Net
 

Get Sql Statistics

using System; using System.Data; using System.Data.SqlClient; using System.Collections.Generic; using System.Text; using System.Collections;     class Program     {         static void Main(string[] args)         {             SqlConnection conn = new SqlConnection("data source=localhost; initial catalog=SampleDB; Integrated Security=SSPI;");             conn.StatisticsEnabled = true;             conn.Open();                 Hashtable ht = (Hashtable)conn.RetrieveStatistics();             foreach (string key in ht.Keys)             {                 Console.WriteLine("{0} : {1}", key, ht[key]);             }                     }     }