// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Data; using System.Data.SqlClient; namespace E { public class Program { public static void Test(int? n) { Console.WriteLine("Pool size: " + n); string constr = "Server=ARNEPC3;Integrated Security=SSPI;Database=master"; if(n != null) { constr += ";Min Pool Size=" + n; } using(SqlConnection con = new SqlConnection(constr)) { con.Open(); SqlCommand cmd = new SqlCommand("sp_who", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader rdr = cmd.ExecuteReader(); while(rdr.Read()) { Console.WriteLine(rdr["spid"] + " " + rdr["loginame"]); } } } public static void Main(string[] args) { Test(null); Test(5); Test(10); Test(15); Test(20); Test(25); } } }