Created
December 2, 2014 01:03
-
-
Save pawelpabich/6a6a85ed4f2d4765e905 to your computer and use it in GitHub Desktop.
SimpleSqlApp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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