Powershell PSCX ado sample

$Provider=”System.Data.SQLClient”
$ConnectionString=”Data Source=.;Initial Catalog=Northwind;Integrated Security=SSPI”
$Connection = Get-AdoConnection $Provider $ConnectionString
$Query = “SELECT * FROM Orders”

Invoke-AdoCommand -ProviderName $Provider -Connection $Connection -CommandText $Query

$Connection.Close()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s