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); }
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)); }
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); }
public SqlExecutor(TextWriter writer, LoginDetails loginDetails) { this.writer = writer; this.loginDetails = loginDetails; loginDetails.Connection.Value.InfoMessage += ConnectionInfoMessage; }