After experiencing a lot of down time, We decided to move this site to
CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.
|
Author |
Message
|
aceaceaceace
-
Total Posts
:
1
- Scores: 0
-
Reward points
:
0
- Joined: 8/12/2009
-
Status: offline
|
Powershell and MS Access
Wednesday, August 12, 2009 5:37 AM
( permalink)
Hi guys, I'm trying to use Powershell to access the Northwind database in MS Access, but I'm receiving this error indefinitely. I just changed the name to NORTH but it's the same. ERROR: At C:\StudyMaterial\PowerShell\nn.ps1:9 char:75 + do {$objRecordset.Fields.Item("Description").Value; $objRecordset.MoveNext( <<<< )} until Exception getting "Item": "Item cannot be found in the collection corresponding to the requested name or ordinal." At C:\StudyMaterial\PowerShell\nn.ps1:9 char:30 + do {$objRecordset.Fields.Item( <<<< "Description").Value; $objRecordset.MoveNext()} until Exception calling "MoveNext" with "0" argument(s): "Operation is not allowed when the object is closed." Here's the code $adOpenStatic = 3
$adLockOptimistic = 3
$objConnection = New-Object -comobject ADODB.Connection
$objRecordset = New-Object -comobject ADODB.Recordset
$objConnection.Connectionstring = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = $pwd\NORTH.mdb"
$objConnection.Open()
$objRecordset.Open("Select * from Categories", $objConnection,$adOpenStatic,$adLockOptimistic)
$objRecordset.MoveFirst()
do {$objRecordset.Fields.Item("Description").Value; $objRecordset.MoveNext()} until
($objRecordset.EOF -eq $True)
$objRecordset.Close()
$objConnection.Close() Please help Thanks.
|
|
|
|
Online Bookmarks Sharing: