Updates wrong table in dataset
-
Hello,
System.Data.OleDb.OleDbCommandBuilder cb = new System.Data.OleDb.OleDbCommandBuilder(dAdapter); if (current\_list == "list1") { DataRow row = myset.Tables\["list"\].NewRow(); int y; y = myset.Tables\["list"\].Rows.Count; row\["ID"\] = y + 1; row\["word"\] = s; // s is user input row\["perc"\] = 0.5; myset.Tables\["list"\].Rows.Add(row); dAdapter.Update(myset, "list"); }
I used break points to confirm that the data is updated here, however, for some reason when I check the database another table is updated instead of "list" Where could be the problem? I checked the code several times, but I'm not sure :confused:
-
Hello,
System.Data.OleDb.OleDbCommandBuilder cb = new System.Data.OleDb.OleDbCommandBuilder(dAdapter); if (current\_list == "list1") { DataRow row = myset.Tables\["list"\].NewRow(); int y; y = myset.Tables\["list"\].Rows.Count; row\["ID"\] = y + 1; row\["word"\] = s; // s is user input row\["perc"\] = 0.5; myset.Tables\["list"\].Rows.Add(row); dAdapter.Update(myset, "list"); }
I used break points to confirm that the data is updated here, however, for some reason when I check the database another table is updated instead of "list" Where could be the problem? I checked the code several times, but I'm not sure :confused:
I don't use dataadapters or datatables, for me they are legacy. But, how is the command of the dataadapter built? If you pass a custom SQL to the data-adapter (I really don't know if this is the case), that could be the cause, not the code block you showed here, as here the data adapter already exists.