I tried using SQLDataAdapter Object in Powershell ISE and its methods like below

```
    $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter 

```

and used its method like below

```
$SqlAdapter.Fill($DataSet)

```

Its working for me. But when I am trying like below

```
$trans= New-Object System.Data.SqlClient.SqlTransaction

```

and using its method like this

```
$trans = $connection.BeginTransaction("SampleTransaction")

```

where

```
$connection= New-Object System.Data.SqlClient.SqlConnection

```

Its giving me error

> 
> Exception calling "BeginTransaction" with "1" argument(s): "Invalid
>  operation. The connection is closed." At line:1 char:41
>  + $trans = $SqlConnection.BeginTransaction <<<< ("SampleTransaction")
>  + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
>  + FullyQualifiedErrorId : DotNetMethodException
> 
> 
> 

Anybody having any idea on this??