NoobProgrammer
MIS
The following are 2 lines that opens a sql connection via the sql .net namespace. The first line does not work, but the second line does. The only difference is the () after the Open function.
When I use the VS 2005 IDE, I believe this is optional, but apparently in PowerShell, this is not. I've done some simple programming, but I don't understand the significance of the parenthesis. Can somebody let me know or link me some info? Thanks!
DOES NOT WORK!
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection "server=myserver;database=database1;Integrated Security=sspi"
$SqlConnection.Open
WORKS!
$sqlConnection = new-object System.Data.SqlClient.SqlConnection "server=myserver;database=database1;Integrated Security=sspi"
$sqlConnection.Open()
When I use the VS 2005 IDE, I believe this is optional, but apparently in PowerShell, this is not. I've done some simple programming, but I don't understand the significance of the parenthesis. Can somebody let me know or link me some info? Thanks!
DOES NOT WORK!
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection "server=myserver;database=database1;Integrated Security=sspi"
$SqlConnection.Open
WORKS!
$sqlConnection = new-object System.Data.SqlClient.SqlConnection "server=myserver;database=database1;Integrated Security=sspi"
$sqlConnection.Open()