Created
April 28, 2016 23:34
-
-
Save ATLPhenx/429a7b92b1768dc7961327b7002e0bcb to your computer and use it in GitHub Desktop.
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
$connectionString = "Server= $SQLServer, $PORT;Database=$SQLDBName;User ID= $Username; Password= $Password;" | |
$conn = New-Object System.Data.SqlClient.SqlConnection | |
$conn.ConnectionString = $connectionString | |
$cmd = New-Object System.Data.SqlClient.SqlCommand | |
$cmd.commandtext = $query | |
$conn.open() | |
if ($conn.Open() -eq $true) | |
{ | |
Write-Host "connection established..." | |
} | |
$cmd.connection = $conn | |
$queryResult = $cmd.ExecuteReader() | |
$conn.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment