Description
Connect to Sql Server and execute SQL statements
Data Source
$Table = new-object System.Data.DataTable
$sqlConn = new-object System.Data.SqlClient.SqlConnection("Data Source=Server\sqlexpress;Initial Catalog=dbProducts;Integrated Security=True")
$adapter = new-object System.Data.SqlClient.SqlDataAdapter("Select * from Products",$sqlConn)
$adapter.Fill($Table)
write-output $table
Source Code and Samples
Wednesday, 14 February 2007
Subscribe to:
Post Comments (Atom)
1 comment:
You could always change
write-output $table
to
$table | Out-GridView
This makes it much easier to read.
Post a Comment