Hi Dear,
I am dealing with SQLite with .net environment.
When I use a TableAdapterManager to update a dataset, which is designed in the visual studio and contain "RowState is Deleted" rows, the ConcurrencyDBException occurr.
If I go to the dataset designer and disable the optimistic concurrency option, it will works.
But I don't want to do anything on the designer, because I am lazy and there're lots of tables there.
So, is there any other way I can fix this problem?
ps: I am pretty sure when I select, update, delete the database, no one (process) else is using it.
Many thanks in advance.
string str = @"data source=C:\TestSQLite\dth_sqlite.s3db;BinaryGUID=False;";
SQLiteConnection conn = new SQLiteConnection(str);
conn.Open();
AllDS ds = new AllDS();
AllDSTableAdapters.CrewClassTableAdapter ad = new AllDSTableAdapters.CrewClassTableAdapter();
ad.Connection = conn;
ad.Fill(ds.CrewClass);
AllDSTableAdapters.CrewConfigTableAdapter ad2 = new AllDSTableAdapters.CrewConfigTableAdapter();
ad2.Connection = conn;
ad2.Fill(ds.CrewConfig);
foreach (ConsoleApplication2.AllDS.CrewClassRow row in ds.CrewClass)
row.Delete();
foreach (ConsoleApplication2.AllDS.CrewConfigRow row in ds.CrewConfig)
row.Delete();
AllDSTableAdapters.TableAdapterManager adm = new AllDSTableAdapters.TableAdapterManager();
adm.CrewClassTableAdapter = new AllDSTableAdapters.CrewClassTableAdapter();
adm.CrewConfigTableAdapter = new AllDSTableAdapters.CrewConfigTableAdapter();
adm.Connection = conn;
adm.UpdateAll(ds);
conn.Close();
Console.WriteLine("press any key ...");
Console.ReadKey();