PowerShell 调用 Oracle.ManagedDataAccess.dll
#
# PowerShell调用 Oracle.ManagedDataAccess.dll
#
[System.Reflection.Assembly]::LoadFrom("C:\oracle\odp.net\managed\common\Oracle.ManagedDataAccess.dll")
$connStr="userid=hr;password=hr;data source=xe"
$conn=New-ObjectOracle.ManagedDataAccess.Client.OracleConnection($connStr)
$conn.Open()
$cmd=$conn.CreateCommand()
$cmd.CommandType=[System.Data.CommandType]::Text
$cmd.CommandText="Select * fromjobs"
$reader=$cmd.ExecuteReader()
$da=New-ObjectOracle.ManagedDataAccess.Client.OracleDataAdapter($cmd )
$table=New-ObjectSystem.Data.DataTable
$cnt=$da.Fill($table)
$cnt
$table