none
Problem when read MSACCESS and uploading data to MSSQL- System.Data.OleDb.OleDbException (0x80040E14): Could not find field 'SID'. RRS feed

  • Question

  • Hello,

    I have a C# program that uploads data from MSACEESS to MSSQL, sometimes on random tables I get an error: (this SID field doesn't exist on the tables I'm uploading and still I get thios error).

    And if I'm uploading the same MSACCESS file again I don't get this error and its uploading well.

    This is the full log:

    15/08/2018 12:33:15.688|Info|Importer (495): starting to process table Payment. import type is 'small
    15/08/2018 12:33:15.688|Info|Importer (495): table 'Payment' got primary 'PaymentID,OrderGuidID,OrderID'
    15/08/2018 12:33:15.688|Info|Importer (495): invoking ReadSmallTableByType for 'Payment with type 'Orders'
    15/08/2018 12:33:15.688|Info|AccessRepository: creating new connection to file 'E:\Uploads\Data_495_2018-08-15_1229.mdb'.
    15/08/2018 12:33:15.696|Info|ReadDataJoinOrders for table 'Payment' took: 7ms
    15/08/2018 12:33:15.699|Error|Importer (495): cannot read access table 'Payment' due to exception
    System.Data.OleDb.OleDbException (0x80040E14): Could not find field 'SID'.
       at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
       at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
       at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
       at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
       at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
       at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
       at System.Data.OleDb.OleDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at AAA.Data.Repositories.AccessRepository.<ReadDataJoinOrders>d__15.MoveNext() in D:\Github\private\Repositories\AccessRepository.cs:line 346
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at AAA.Data.Importer.<ReadSmallTableByType>d__69.MoveNext() in D:\Github\private\Importer.cs:line 1220
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at AAA.Data.Importer.<>c__DisplayClass62_0.<<AddAAADataAndInsert>b__1>d.MoveNext() in D:\Github\private\Importer.cs:line 1011
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at AAA.Data.Importer.<AddAAADataAndInsert>d__62.MoveNext() in D:\Github\private\Importer.cs:line 1018
    15/08/2018 12:33:15.700|Info|Importer (495): AddAAADataAndInsert threw error. doing retry. error details: $
    $System.Data.OleDb.OleDbException (0x80040E14): Could not find field 'SID'.
       at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
       at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
       at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
       at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
       at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
       at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
       at System.Data.OleDb.OleDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at AAA.Data.Repositories.AccessRepository.<ReadDataJoinOrders>d__15.MoveNext() in D:\Github\private\Repositories\AccessRepository.cs:line 346
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at AAA.Data.Importer.<ReadSmallTableByType>d__69.MoveNext() in D:\Github\private\Importer.cs:line 1220
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at AAA.Data.Importer.<>c__DisplayClass62_0.<<AddAAADataAndInsert>b__1>d.MoveNext() in D:\Github\private\Importer.cs:line 1011
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at AAA.Data.Importer.<AddAAADataAndInsert>d__62.MoveNext() in D:\Github\private\Importer.cs:line 1024
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       at AAA.Data.Importer.<>c__DisplayClass37_1.<<ProcessTables>b__1>d.MoveNext() in D:\Github\private\Importer.cs:line 305
    15/08/2018 12:33:15.700|Info|Importer (495): AddAAADataAndInsert failed for table 'Payment'. check previous log file rows for details.


    Wednesday, August 15, 2018 10:15 AM

All replies

  • Well, your importer code expects a column SID in the table Payment. Which seems to not exists. Thus that error.

    But when your finding about "uploading" the same file again works, you should check a) the error handling, maybe your masking the real error and b) check whether you're not running into a concurrency issue (race condition).

    Monday, September 3, 2018 12:52 PM