The following flowchart includes some code for Insert and update/delete selction:
Are there different ways of deleting a records? I thought Insert, update, and delete) use something like Update("Insert .... Delete.... Update....") which is not included here.
Q1: If there are different ways of doing this, could you please show me both ways? Once using Update("Insert .... Delete.... Update....") method and once .Delete, .Insert, .Update methods?
Q2: I wonder if you could also add some demo code for other 3 boxes (SqlConnection, SqlAddapter, SqlDataset) shown on this image, where applicable?
Basically, I want have one set of code makes this work.
In case needed:
NewRow = dataSet.Tables("Table Name").NewRow
NewRow("Column Name") = Val
Dim Foundresults() As DataRow = dataSet.Tables("TName").Select(filter)
Foundresults(i)(columnIndex) = newValue
After posting this question, I located the following:
"In addition to the InsertCommand, UpdateCommand, and DeleteCommand, TableAdapters are created with methods that can be executed directly against the database. These methods (TableAdapter.Insert, TableAdapter.Update, and TableAdapter.Delete) can be called directly to manipulate data in the database. This means you can call these individual methods from your code instead of calling TableAdapter.Update to handle the inserts, updates, and deletes that are pending for the associated data table.
If you do not want to create these direct methods, set the TableAdapter's GenerateDbDirectMethods property to false (in the Properties window). Additional queries added to the TableAdapter are standalone queries — they do not generate these methods. (at http://msdn.microsoft.com/en-us/library/bz9tthwx.aspx
which relates to my first question. Despite this, it would be nice to have sample codes from you.