Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ATLPhenx/781ff6dc93258916f975d164a0fbe96d to your computer and use it in GitHub Desktop.
Save ATLPhenx/781ff6dc93258916f975d164a0fbe96d to your computer and use it in GitHub Desktop.
function selectPOSData ($Server, $Database, $Username, $Password) {
$Connection = New-Object System.Data.SQLClient.SQLConnection
$Connection.ConnectionString = "server=$Server;database=$Database;User ID= $Username; Password= $Password;"
$Command = New-Object System.Data.SQLClient.SQLCommand
$Connection.Open()
$Command.Connection = $Connection
$Command.CommandText = 'somequery'
# Fill the DataSet.
$ds=New-Object system.Data.DataSet
$da=New-Object system.Data.SqlClient.SqlDataAdapter($Command)
$da.fill($ds) | Out-Null
$Connection.Close()
return $ds
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment