#
# 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
时间: 2024-10-19 21:13:42