Software⏱️ 3 min read📅 2026-06-04

How to Fix: What can I do to resolve a "Row not found or changed" Exception in LINQ to SQL on a SQL Server Compact Edition Database?

Learn how to fix: What can I do to resolve a "Row not found or changed" Exception in LINQ to SQL on a SQL Server Compact Edition Database?.

Quick Answer: Try checking your system settings or restarting.

The 'Row not found or changed' exception in LINQ to SQL on a SQL Server Compact Edition database occurs when the DataContext attempts to update a record that does not exist or has been modified by another user.

This issue affects developers who use LINQ to SQL with SQL Server Compact Edition databases and experience difficulties when submitting changes using the SubmitChanges method.

🛑 Root Causes of the Error

  • The primary cause of this error is due to the fact that SQL Server Compact Edition does not support optimistic concurrency control, which means that it does not track changes made by other users.
  • Another possible cause is that the database is not properly synchronized with the DataContext, leading to inconsistencies in the data.

🛠️ Step-by-Step Verified Fixes

Synchronize the DataContext with the Database

  1. Step 1: Use the Refresh method on the DataContext to retrieve the latest data from the database.
  2. Step 2: Check for any changes made by other users and apply them manually if necessary.
  3. Step 3: Verify that the DataContext is correctly configured to use SQL Server Compact Edition.

Use a Different Concurrency Strategy

  1. Step 1: Consider using pessimistic concurrency control instead of optimistic concurrency control, which can be achieved by adding a timestamp column to the table being updated.
  2. Step 2: Use the Merge method on the DataContext to update the record and handle any conflicts that may arise.

✨ Wrapping Up

To resolve the 'Row not found or changed' exception in LINQ to SQL on a SQL Server Compact Edition database, it is recommended to synchronize the DataContext with the database using the Refresh method, or to use a different concurrency strategy such as pessimistic concurrency control. By following these steps, developers can minimize the occurrence of this error and ensure data consistency.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions