Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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