Created
October 3, 2012 18:09
-
-
Save pmn/3828691 to your computer and use it in GitHub Desktop.
Gather connection info in windows
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
func getConnectionInfo() string { | |
// Prompt the user for connection string info | |
var servername, username, password string | |
reader := bufio.NewReader(os.Stdin) | |
fmt.Print("Enter Server Name:") | |
servername, _ = reader.ReadString('\n') | |
servername = strings.TrimRight(servername, "\r\n") | |
fmt.Print("Enter User Name:") | |
username, _ = reader.ReadString('\n') | |
username = strings.TrimRight(username, "\r\n") | |
fmt.Print("Enter Password:") | |
password, _ = reader.ReadString('\n') | |
password = strings.TrimRight(password, "\r\n") | |
connstr := "Data Source=" + servername + ";user id=" + username + ";password=" + password | |
return connstr | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment