How can I write using in power shell ?
This is working example in C#
using (var conn = new SqlConnection(connString))
{
Console.WriteLine("InUsing");
}
I need same in Powershell (not working):
Using-Object ($conn = New-Object System.Data.SqlClient.SqlConnection($connString)) {
Write-Warning -Message 'In Using';
}
It is working without using:
$conn = New-Object System.Data.SqlClient.SqlConnection($connString)
Thank you for help.
See Question&Answers more detail:os