using System;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Text;

namespace Command3
{
   class Program
   {
      static void Main(string[] args)
      {
         SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder();
         sb.IntegratedSecurity = true;
         sb.InitialCatalog = "TestDB";
         sb.DataSource = @".\SQLExpress";
         SqlConnection conn = new SqlConnection(sb.ConnectionString);
         conn.Open();

         SqlCommand cmd = conn.CreateCommand();
         cmd.CommandText = "sp_Query_UserCount";
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@UserCount", SqlDbType.Int));
         cmd.Parameters[0].Direction = ParameterDirection.Output;
         cmd.ExecuteNonQuery();
         Console.WriteLine(
           string.Format("W bazie danych znajduje się {0} użytkowników."),
             cmd.Parameters[0].Value);
         Console.ReadLine();
      }
   }
}
