Solved

Using MS Powershell to Query MS Access with Complex SQL Query

Posted on 2008-10-30
1
573 Views
Last Modified: 2013-12-22
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!
0
Comment
Question by:bgsullivan
1 Comment
 
LVL 18

Accepted Solution

by:
BSonPosh earned 500 total points
ID: 22844377
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Healthcare providers, insurance companies and other covered entities trust eFax Corporate to transmit their most sensitive documents. eFax Corporate can help your organization implement a HIPAA compliant cloud faxing solution.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question