1

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!

Akshita
  • 849
  • 8
  • 15
Elyor
  • 900
  • 1
  • 12
  • 26
  • 2
    You _just_ showed your error message. Put your work and a little bit explanation as well. – Soner Gönül Jun 26 '15 at 10:25
  • 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](http://stackoverflow.com/help/mcve) that demonstrates which code line causes the issue and what you are trying to achieve. – Heinzi Jun 26 '15 at 10:28

1 Answers1

0

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

ryanyuyu
  • 6,366
  • 10
  • 48
  • 53
  • It's not multi-threading problem!,but you choose to "Any-CPU" your application environment also good worked with "Data Access Engine 2007 x86".Try them.... – Elyor Jun 26 '15 at 13:18