Skip to content

Instantly share code, notes, and snippets.

@pawelpabich
Created December 2, 2014 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pawelpabich/6a6a85ed4f2d4765e905 to your computer and use it in GitHub Desktop.
Save pawelpabich/6a6a85ed4f2d4765e905 to your computer and use it in GitHub Desktop.
SimpleSqlApp
using System;
using System.Data.SqlClient;
namespace SqlTests
{
class Program
{
private static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
using (var connection = new SqlConnection("Data Source=.;Initial Catalog=ServicesPortal;Integrated Security=True;Connection Timeout=30"))
{
connection.Open(); //causes Audit Login
using (var command = new SqlCommand("Select Count(*) from Contracts.Contracts", connection))
{
var result = command.ExecuteScalar();
Console.WriteLine("Result: {0}", result);
}
} //call to Dispose method causes Audit Logout
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment