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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…