DELETE using OLEDB Command object reflected in MDB but NOT in dataset
Posted on 2006-06-01
I am using an OLEDB command to delete a given row from an MDB :
AnswerDataAdapter.DeleteCommand = MPLCommand("DELETE * FROM " & _
"Answer WHERE PK=" & Row)
Seems to work fine with the MDB but I run into all sorts of concurrency issues with regards to the respective dataset.
I am also doing INSERTIONS but I haven't had any problems with concurrency there:
drAnswer = Me.AnswerDataTable.NewRow()
drAnswer("UniqueID") = UniqueID
drAnswer("Answer") = Answer
drAnswer("InputMask") = InputMask
Dim drModifiedAdded As DataRow() = Me.MPLDataSet.Tables(dtAnswer.TableName).Select(Nothing, Nothing, DataViewRowState.Added)
Catch Ex As DbException
Dim errormsg As String()
errormsg = Ex.Message.Split(".")
Form1.ToolStripStatusLabel1.Text = errormsg(0) & "..."
My question is this: Should I use the same construct to do DELETIONS as I use for INSERTIONS? In other words, should I mark a row for deletion in the dataset and then do an Update and NOT use the OLEDB COMMAND object to do the deletion? If so, will this take care of both the MDB update AND the dataset update such that they are synchronized?
Sorry if this seems remedial but the many-paths-to-one-solution aspect of .Net databasing sometimes leads me to conceptual bottlenecks.