Revindex Task Scheduler

Export Print

Get connection string (PowerShell)

You can get connection strings stored in your Web.config in PowerShell by issuing the following statement:


$connectionString = [DotNetNuke.Common.Utilities.Config]::GetConnectionString("SiteSqlServer")
$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = $connectionString
$command = $connection.CreateCommand()
$command.CommandText = "UPDATE table1 SET col1 = '1' WHERE col1 = '2'"
$connection.Open()
$command.ExecuteNonQuery()
$connection.Close()

Comments

Add comment

Powered by Revindex Wiki