using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Microsoft.SqlServer.Management.Common;
using System.Data.SqlClient;

namespace SMOWindowsApplication1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            ServerConnection serverConnection = new ServerConnection();
            serverConnection.NonPooledConnection = true;
            serverConnection.ConnectAsUser = true;
            serverConnection.ConnectAsUserName = args[0];
            serverConnection.ConnectAsUserPassword = args[1];
            serverConnection.Connect();
            SqlCommand cmd = new SqlCommand(
                "Select * from pubs..authors", serverConnection.SqlConnectionObject);
            SqlDataReader rdr = cmd.ExecuteReader();
            while (rdr.Read())
            {
                Console.WriteLine(rdr[0]);
            }
            rdr.Close();
            cmd.Connection.Close();
        }
    }
}