www.evidhyashala.com provides free free mock test , free online exam , online exam free test series , online exam free , Online Test Exam Series , free exam papers past papers , online exam form ,Online Test Series for Exam Prep. Free Mock Tests - for All govt jobs. Bank PO, Clerk, SSC CGL, CHSL, JE, GATE, Insurance, Railways, IBPS RRB, SBI, RBI, IPPB, BSNL TTA

Sponser Link

know more info pls click here

Give an example to show how DataSets provide transaction processing?-tech17032012

Let us assume we have a DataGrid that displays employee information. Every row also has a delete button, which when you click will delete that row. On this page we also have a Restore and Commit buttons. When you click the Restore button you should be able to restore the data to its previous state. When you click the Commit button you should be able to update the database with the deletions made in the DataSet. The code for Commit and Restore buttons is shown below. private void butRestore_Click(object sender, System.EventArgs e) { // Restore the data set to its original state. dsContacts.RejectChanges(); // Refresh the data grid. grdContacts.DataBind(); } private void butCommit_Click(object sender, System.EventArgs e) { int intRows; // Update the database from the data set. intRows = adptContacts.Update(dsContacts); // Save changes to state variable. Session["dsContacts"] = dsContacts; // Refresh the data grid. grdContacts.DataBind(); } The RejectChanges method in the preceding butRestore_Click event procedure returns the data set to its state before the row was deleted. The data set’s AcceptChanges method is the inverse of RejectChanges—it resets the DataRowState property for all the changed rows in a data set to Unchanged and removes any deleted rows. The AcceptChanges method prevents the Update method from making those changes in the database, however, because Update uses the rows’ DataRowState property to determine which rows to modify in the database. For this reason, the AcceptChanges method is useful only when you do not intend to update a database from the data set.

0 comments:

Popular Posts