Ejemplo n.º 1
0
 private static string BuildConnectionString(LoginDetails loginDetails)
 {
     if (loginDetails.TrustedConnection)
     {
         return string.Format("Server={0};Database={1};Trusted_Connection=true;", loginDetails.Server, loginDetails.DatabaseName);
     }
     return string.Format("Server={0}; Database{1}; User={2}; Password={3};",
         loginDetails.Server, loginDetails.DatabaseName, loginDetails.UserName, loginDetails.Password);
 }
Ejemplo n.º 2
0
 private static string BuildConnectionString(LoginDetails loginDetails)
 {
     if (loginDetails.TrustedConnection)
     {
         return(string.Format("Server={0};Database={1};Trusted_Connection=true;", loginDetails.Server, loginDetails.DatabaseName));
     }
     return(string.Format("Server={0}; Database{1}; User={2}; Password={3};",
                          loginDetails.Server, loginDetails.DatabaseName, loginDetails.UserName, loginDetails.Password));
 }
Ejemplo n.º 3
0
        public static LoginDetails Get(string[] args)
        {
            bool help         = false;
            var  loginDetails = new LoginDetails();

            var optionSet = new OptionSet
            {
                { "?", "show syntax summary", h => help = true },
                { "U", "login id (default: null/trusted connection)", user => loginDetails.UserName = user },
                { "P", "password (default: null/trusted connection)", password => loginDetails.Password = password },
                { "S", "server (default: .\\sqlexpress", server => loginDetails.Server = server },
                { "d", "database name (default: master)", db => loginDetails.DatabaseName = db },
                { "E", "trusted connection (default: true / if not user name is supplied)", db => loginDetails.DatabaseName = db }
            };

            optionSet.Parse(args);

            if (help)
            {
                optionSet.WriteOptionDescriptions(Console.Out);
                return(null);
            }
            return(loginDetails);
        }
Ejemplo n.º 4
0
 public SqlExecutor(TextWriter writer, LoginDetails loginDetails)
 {
     this.writer       = writer;
     this.loginDetails = loginDetails;
     loginDetails.Connection.Value.InfoMessage += ConnectionInfoMessage;
 }