static void Main(string[] args) { var connection = new SqlClient.SqlConnection(args[0]); connection.Open(); Console.WriteLine("connected"); var serverConnection = new Common.ServerConnection(connection); var server = new Smo.Server(serverConnection); var db = new Smo.Database(server, "master"); Console.WriteLine(db.ToString()); var results = db.ExecuteWithResults("SELECT * FROM sys.tables"); DoQuery(db); while (true) { Console.WriteLine("Want to try again?"); var key = Console.ReadKey(true); if (key.KeyChar.Equals('n')) { break; } try { DoQuery(db); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }