NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I make an OLE DB Connection from inside a .NET Action Step (C#)?

Solved!
Go to solution

I'm trying to make a OLE DB connection to a MS Access file on my computer. I'm trying to do it by having a .NET Action Step in TestStand call a method that I've written in C# that makes the connection, queries the database, etc. I have attached a sequence file and C# code that illustrates what I'm doing.

 

When I call the method, I get this error (I have attached a screenshot of the error in TestStand):

System.InvalidOperationException: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

 

Why am I getting this error and how can I get around it?

 

I know Microsoft.ACE.OLEDB.12.0 is registered on my local machine because if I call the same method from Main() in my compiled C# code, it will work fine. There's clearly something different between when Main() calls the method and when TestStand calls the method, but I don't know what it is.

Download All
0 Kudos
Message 1 of 3
(914 Views)
Solution
Accepted by topic author Dana517

If it works in your C# app, but not in TestStand, you should probably double check that you are using the same bitness (32 vs 64) for both.

0 Kudos
Message 2 of 3
(879 Views)

That was it! It's 64-bit TestStand. In Visual Studio, I went into the Project Properties > Build and the checkbox was checked for "Prefer 32-bit". After I unchecked it, the same exception comes up outside of TestStand as well as inside. Which is fine. I can figure that one out.

0 Kudos
Message 3 of 3
(873 Views)