ERROR: Exception calling "Add" with "1" argument(s): "This row already belongs to another table." MainForm.psf (186, 6): ERROR: At Line: 186 char: 6
Now line 186 refers to the ConvertTo-DataTable functions supplied when inserting the first DataGridView. I understand the concept that a new row needs to be created for each line added to a table however these are separate calls to the function in which it creates a new object. Should this not be an entirely new entity?
My call lines are like below:
Code: Select all
$BiosData = ConvertTo-DataTable -InputObject $SQLBiosData -FilterWMIProperties -RetainColumns -Table ONE
Update-DataGridView -DataGridView $datagridviewBios -Item $BiosData -AutoSizeColumns DisplayedCells
$ProcessorData = ConvertTo-DataTable -InputObject $SQLProcessorData -FilterWMIProperties -RetainColumns -Table TWO
Update-DataGridView -DataGridView $datagridviewProcessor -Item $ProcessorData -AutoSizeColumns DisplayedCells
Code: Select all
$SQLBiosData = Invoke-Sqlcmd -Query "SELECT Manufacturer,SMBIOSBIOSVersion,SMBIOSMajorVersion,SMBIOSMinorVersion FROM dbo.Bios WHERE PSComputerName = '$($listboxServerList.SelectedItem)'" -ConnectionString $global:SqlConnection -OutputAs DataTables
$SQLProcessorData = Invoke-Sqlcmd -Query "SELECT Manufacturer,MaxClockSpeed,NumberOfCores,NumberOfLogicalProcessors,SocketDesignation,Status FROM dbo.Processor WHERE PSComputerName = '$($listboxServerList.SelectedItem)'" -ConnectionString $global:SqlConnection
Thanks