Skip to content

Instantly share code, notes, and snippets.

@pmn
Created October 3, 2012 18:09
Show Gist options
  • Save pmn/3828691 to your computer and use it in GitHub Desktop.
Save pmn/3828691 to your computer and use it in GitHub Desktop.
Gather connection info in windows
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