Search code examples
comcom-interop

Invalid STDGMEDIUM structure (Exception from HRESULT: 0x80040066 (DV_E_STGMEDIUM)) error


I am writing a program written in C# that interfaces with a Sage Payroll database - essentially an Access database.

This uses a Sage library to connect to the database and returns error codes if any occur. I have the program working correctly on 2 machines. When I run it on the production machine I get the following Sage error:

Error value: 102
Error code: -2147221402
Error text: Database file locked, not valid or corrupt

I am confident that there is not a problem with the database as if I copy this to any other machine and run the program it works correctly.

The exception I get is:

Exception: Message: Invalid STDGMEDIUM structure (Exception from HRESULT: 0x80040066 (DV_E_STGMEDIUM))

I think the error is something COM/Interop related on the production machine. I have Administrator privileges and the Sage dlls have all been registered correctly.

Can anyone shed any light on this error code?


Solution

  • I never got to the bottom of this problem but from speaking to the vendor I think it was something connected to their library, possibly permissions or unsupported on certain OSes.