mbt masai
 
Welcome !
         

                                
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.

 Powershell and MS Access

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)
0
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.
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.8
    mbt shoes www.wileywilson.com