Link to home
Start Free TrialLog in
Avatar of bgsullivan
bgsullivan

asked on

Using MS Powershell to Query MS Access with Complex SQL Query

Hello,

I am trying to query an MS Access DB from a PowerShell script using a fairly routine SQL statement and am running into a strange error.  I am using the methodology outlined here:

http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan08/hey0115.mspx

Which works fine for a standard SQL query.  But I want to use a WHERE statement in my query.  So line six would look like:

$objRecordset.Open("Select * From Computers WHERE operating_system = 'Windows XP'", $objConnection,$adOpenStatic,$adLockOptimistic)

But when I execute this line in PowerShell I get an error stating that the function call cannot accept five parameters.  Unfortunatly nothing I try helps me get around this issue.  I've tried -eq in place of the equals sign, placing the SQL in parentheses, etc and had no joy.

Does anyone know how to get around this issue?

Thank you!
ASKER CERTIFIED SOLUTION
Avatar of BSonPosh
BSonPosh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial