We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
After that I just use the $dataset.Tables.Rows to retrieve data. But besides the point. As I stated earlier, the code works fine if the uid and pwd commands are not used.
## Create our object to access Access Table $dataSource = "<.mdb file location>" $strQuery = "SELECT * FROM table" $dsn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$dataSource;uid=<username>;pwd=<password>;" ## create connection object and open the database $objConn = New-Object System.Data.OleDb.OleDbConnection $dsn $objCmd = New-Object System.Data.OleDb.OleDbCommand $strQuery,$objConn $objConn.Open() ## get query results, populate data-adapter, close connection $adapter = New-Object System.Data.OleDb.OleDbDataAdapter $objCmd $dataset = New-Object System.Data.DataSet [void] $adapter.Fill($dataSet) $objConn.Close()
An important factor to consider: This Access DB is using linked tables to a Pervasive DB. So the credentials are not to authenticate to Microsoft Access Table/DB, but rather to access the DB on the other server.
Exception calling "Open" with "0" argument(s): "Could not find installable ISAM." At <script location>:56 char:14 + $objConn.Open <<<< () + CategoryInfo : NotSpecified: (:) , MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException Exception calling "Fill" with "1" argument(s): "Could not find installable ISAM." At <script location>:61 char:21 + [void] $adapter.Fill <<<< ($dataSet) + CategoryInfo : NotSpecified: (:) , MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.