1
votes

I am connecting to MS Access file with jet Engine x64,but also worked x86 platform. I am getting error while trying to read data

            long sizeCounter = 0, rowIndex = 0;
            var secondValues = new object[BatchSize][];

            for (var secondIndex = 0; secondIndex < secondValues.Length; secondIndex++)
                secondValues[secondIndex] = new object[reader.FieldCount];

            while (reader.Read())
            {
               //TODO:Error get from here...
                reader.GetValues(secondValues[sizeCounter]);

                sizeCounter++;

                if (NotifyAfter > 0 && (rowIndex % NotifyAfter == 0 && rowIndex > 0 && RowsCopied != null))
                {
                    RowsCopied(this, new RowsCopiedEventArgs(rowIndex));
                }

                if (sizeCounter == BatchSize)
                {
                    RunBulkCopy(secondValues);

                    sizeCounter = 0;
                }

                rowIndex++;
            }

            var lastValues = new object[sizeCounter][];

            for (var lastIndex = 0; lastIndex < sizeCounter; lastIndex++)
                lastValues[lastIndex] = secondValues[lastIndex];

            RunBulkCopy(lastValues);

            if (RowsCopied != null)
                RowsCopied(this, new RowsCopiedEventArgs(rowIndex));
        }
        catch (Exception)
        {
            if (RowsCopied != null)
                RowsCopied(this, new RowsCopiedEventArgs
                {
                    Abort = true
                });
        } 

Unable to cast COM object of type 'System.__ComObject' to interface type 'IRowset'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{0C733A7C-2A1C-11CE-ADE5-00AA0044773D}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Thanks!

1
You just showed your error message. Put your work and a little bit explanation as well.Soner Gönül
Hello elyor! I have voted to put your question on hold, since your question is unclear as it currently stands and cannot be answered reasonably. I understand that you get this error message, but your question is missing a minimal example that demonstrates which code line causes the issue and what you are trying to achieve.Heinzi

1 Answers

0
votes

OleDb data connector has a bug when used in multi-threaded projects.The exception throws when you create OleDb object in STA apartment and call it from MTA.

Microsoft report of the issue