title: Calling stored procedure using powershell
body: <p>i am trying to call a stored procedure from powershell by running the following. The name of the stored procedure is sp_sample (residing in ssms). But i am not able to see any output for the code in powershell and neither is the procedure getting triggered. Could someone please correct it.</p>
  
  <pre><code>$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
  $SqlConnection.ConnectionString = "Server=LABVM-
   40\RTC;Database=testDB;Integrated Security=True"
  $SqlCmd = New-Object System.Data.SqlClient.SqlCommand
  $SqlCmd.CommandText ="sp_sample"
  $SqlCmd.Connection = $SqlConnection
  $sqlConnection.Open()
  $Result = $SqlCmd.ExecuteNonQuery()
  $sqlConnection.Close()
  </code></pre>
  
  <p>PS: I dont have knowledge on powershell and i picked the above code from the internet. </p>