您的位置:首页 > 博客中心 > 数据库 >

PowerShell 调用 Oracle.ManagedDataAccess.dll

时间:2022-03-13 22:56



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

 


热门排行

今日推荐

热门手游