I am trying to manipulate some mysql databases with powershell. I found a really informative post of a one size fits all database connector. So the connection part is working. My current crisis is I can not access the values that are being returned.
I get a System.Data.Common.DataRecordInternal object for each result in the query.
The items table consists of 3 columns; itemID, itemName, itemInUse and there are 10 records in the table
function dbExecute([string]$command){
dbPrepareResult
if (!$global:MLMcommand) {
dbOpen
}
$global:MLMcommand.CommandType = [System.Data.CommandType]::Text
$global:MLMcommand.CommandText = $command
$global:MLMresult = $global:MLMcommand.ExecuteReader()
return $global:MLMresult
}
$query = "SELECT * FROM items"
$results = dbExecute $query
foreach($result in $results){
write-host $result
}This results in 10 System.Data.Common.DataRecordInternal lines. I tried appending .columnNames to no avail. I have to be pretty close.
Sorry for the horrible formatting. Could not find the code/code equivalent so I used <pre>
Thanks!
Ed