I am using Get-ACEdata to manipulate MS-ACCESS databases (*.accdb or *.mdb). This involves ADO objects. The OLEDB version to connect is OLEDB.12.0 (Win7, 64-bit).
The database is simple: 1 table, 5 fields (ID,LName,FName,Sex,DOB).
My processing always begins with Get-ACEdata and a simple SQL query, which results in a Dataset. For the purposes of this post (irrelevant details skipped):
$objRecordset = New-Object -comobject ADODB.Recordset
Get-ACEdata -filepath $DBpath -table $Tab1
$i = 0
do {
# Tables[0].Rows[$i] gets the (i+1)th row.
$f1 = Tables[0].Rows[$i].Fname
$f2 = Tables[0].Rows[$i].Lname
$i++
# etc.
} until $ObjRecordSet.EOF -eq $True
This works fine, but involves several lines (about 7-10) of parsing each field and then rebuilding a CSV file. I am wondering if there is a “Powershell way” in which I can “pipe” each row, use the Foreach cmdlet and then Export to a CSV file.
Would be grateful for any advice or guidance.