'Save changes in ms access file
$path = “C:\path\myfile.mdb”
$cn = new-object -comobject ADODB.Connection
$rs = new-object -comobject ADODB.Recordset
Opening connection to the Database
$cn.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=$path;
Jet OLEDB:Database Password=mypassword;")
Query that i want to edit
$query = "Select Taxes from TaxBands"
$rs.Open($query, $cn)
$data = $rs.GetRows()
Updating and multiplying the values in the Taxes column
foreach ($row in $data)
{
$row= $row*2
write-host $row
}
Question: How to save and update the new values in the table TaxBands from $row and close the mdb file.
Solution 1:[1]
Update values with the fields and value: $recordSet.Fields.Item("lastName").value
And close the objects with .close(): $cn.Close() and $rs.Close()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jack_skellington |
