Skip to content

Commit

Permalink
Get-DbaDbccMemoryStatus - remove dependency on system.data objects an…
Browse files Browse the repository at this point in the history
…d use standard constructs (#5031)

* Remove dependancy on system.Data objects

* Fix case of variable

* Modify to use the  .query custom method
  • Loading branch information
sqllensman authored and potatoqualitee committed Feb 3, 2019
1 parent 61faa32 commit f707a63
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions functions/Get-DbaDbccMemoryStatus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,13 @@ function Get-DbaDbccMemoryStatus {

Write-Message -Level Verbose -Message "Collecting $query data from server: $instance"
try {
$sqlconnection = New-Object System.Data.SqlClient.SqlConnection
$sqlconnection.ConnectionString = $server.ConnectionContext.ConnectionString
$sqlconnection.Open()

$datatable = New-Object system.Data.DataSet
$dataadapter = New-Object system.Data.SqlClient.SqlDataAdapter($query, $sqlconnection)
$dataadapter.fill($datatable) | Out-Null
$datatable = $server.query($query, 'master', $true)

$recordset = 0
$rowId = 0
$recordsetId = 0

foreach ($dataset in $datatable.Tables) {
foreach ($dataset in $datatable) {
$dataSection = $dataset.Columns[0].ColumnName
$dataType = $dataset.Columns[1].ColumnName
$recordset = $recordset + 1
Expand Down

0 comments on commit f707a63

Please sign in to comment.