0

From my powershell script,i am trying to connect to Postgresql database. When i try to import Npgsql.dll, it throws "Cannot find type [System.Data.Npgsql.SqlCommand]: verify that the assembly containing this type is loaded"

    Import-Module '.\Npgsql.dll'
    #Add-Type -Path '.\Npgsql.dll'
    $conn = New-Object System.Data.Npgsql.NpgsqlConnection
    $conn.ConnectionString = "Server=**;Port=**;User Id=**;Password=**;Database=**;"
    $cmdText = "select * from **"
    $conn.Open()
    $cmd = New-Object System.Data.Npgsql.SqlCommand($cmdText,$conn)
    $rdr = $cmd.ExecuteReader()
4

2 に答える 2