Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20396

Re: Get error when run get-swisdata $Swis

$
0
0

Hello, according to your console output I assume you are using SQL management libraries (not functionality of SDK), but in case of SQL commands you need to create new object for SQL Command, which will contain also Connection information and also open the connection and close after you finish. The syntax will be like:

 

$ConnectionString = ("Server=" + $Server + "; Database='" + $Database + "'; User Id='" + $SQL_Login + "'; Password='" + $SQL_Password + "'; Trusted_Connection=False;")

$SQLConnection = New-Object system.Data.SqlClient.SqlConnection($ConnectionString)

$SQLConnection.Open()

$SQLCommand = New-Object system.Data.SqlClient.SqlCommand

$SQLCommand.Connection = $SQLConnection

$SQLCommand.CommandText = "  INSERT INTO ............" #Example. Insert your non-query command

$SQLCommand.ExecuteNonQuery() | Out-Null

$SQLConnection.Close()


Viewing all articles
Browse latest Browse all 20396

Trending Articles