none
SqlCeDataAdapter.Update fails silently RRS feed

  • Question

  • Hi. My application uses SQL Compact 3.5 to store some data, but sometimes when I call the Update method the row state doesn't change and the changes don't persist. Here's what I'm doing:

    'Debugging code
    Debug.WriteLine(String.Join(vbCrLf, (From r As MyDataSet.MyRow In MyDataSet.MyTable Select r.RowState.ToString() & " - " & r.Id).ToArray()))
    
    MyTableAdapter.Update(MyDataSet.MyTable)
    
    'Same as above
    Debug.WriteLine(String.Join(vbCrLf, (From r As MyDataSet.MyRow In MyDataSet.MyTable Select r.RowState.ToString() & " - " & r.Id).ToArray()))
    Here's the output:

    Added - 6036
    Added - 6038
    Added - 6203
    Added - 7815
    Added - 6204

    Unchanged - 6036
    Added - 6038
    Added - 6203
    Unchanged - 7815
    Added - 6204

    Actually, this is not real data, because I can't even predict when it's going to happen. But that's how it looks like. It's sort of a random behavior.

    Has anyone seen anything like that? I have no clue what's going on.

    Thank you.

    • Moved by Val MazurModerator Friday, January 4, 2013 2:11 PM (From:ADO.NET Managed Providers)
    Thursday, January 3, 2013 9:01 PM

Answers

  • What is MyTableAdapter.ContinueUpdateOnError value is set to?

    If MyTableAdapter.ContinueUpdateOnError is set to true, no exception is thrown when an error occurs during the update of a row. The update of the row is skipped and the error information is placed in the RowError property of the row in error.

    Verify Row Error property and see if that resolve your issue.

    Regarding Row State Is Ids 6036, 7815 are already present in database before you call Update?


    Lingaraj Mishra

    • Proposed as answer by Cor Ligthert Friday, January 4, 2013 4:41 PM
    • Marked as answer by Alexander Sun Wednesday, January 16, 2013 9:26 AM
    • Unmarked as answer by Leonardo B Thursday, January 24, 2013 12:20 AM
    • Marked as answer by Leonardo B Thursday, January 24, 2013 12:33 AM
    Friday, January 4, 2013 10:45 AM

All replies

  • What is MyTableAdapter.ContinueUpdateOnError value is set to?

    If MyTableAdapter.ContinueUpdateOnError is set to true, no exception is thrown when an error occurs during the update of a row. The update of the row is skipped and the error information is placed in the RowError property of the row in error.

    Verify Row Error property and see if that resolve your issue.

    Regarding Row State Is Ids 6036, 7815 are already present in database before you call Update?


    Lingaraj Mishra

    • Proposed as answer by Cor Ligthert Friday, January 4, 2013 4:41 PM
    • Marked as answer by Alexander Sun Wednesday, January 16, 2013 9:26 AM
    • Unmarked as answer by Leonardo B Thursday, January 24, 2013 12:20 AM
    • Marked as answer by Leonardo B Thursday, January 24, 2013 12:33 AM
    Friday, January 4, 2013 10:45 AM
  • Hi. Sorry for taking that long to reply. I didn't get any e-mail notification about your answer. I'll check my profile settings.

    That was a good guess. I was setting this property as true elsewhere in my code and ended up overlooking that line. I'll fix it and wait for the next time it fails, so I can get the error message.

    Thank you.

    Thursday, January 24, 2013 12:33 AM