26.02.2015 Views

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Dataset has “AcceptChanges” method which commits all the changes since last time<br />

“Acceptchanges” has been executed.<br />

Note :- This book does not have any sample of Acceptchanges.I leave that to reader’s as<br />

homework sample.But yes from interview aspect that will be enough.<br />

(B) How can we check that some changes have been made<br />

to dataset since it was loaded ?<br />

Twist :- How can we cancel all changes done in dataset ? , How do we get values which are<br />

changed in a dataset ?<br />

For tracking down changes Dataset has two methods which comes as rescue “GetChanges<br />

“and “HasChanges”.<br />

GetChanges<br />

Return’s dataset which are changed since it was loaded or since Acceptchanges was<br />

executed.<br />

HasChanges<br />

This property indicate’s has any change’s been made since the dataset was loaded or<br />

acceptchanges method was executed.<br />

If we want to revert or abandon all change’s since the dataset was loaded use<br />

“RejectChanges”.<br />

Note:- One of the most misunderstood things about these properties is that it tracks the<br />

changes of actual database.That’s a fundamental mistake , actually the changes are related<br />

to only changes with dataset and has nothing to with changes happening in actual<br />

database.As dataset are disconnected and do not know anything about the changes<br />

happening in actual database.<br />

(B) How can we add/remove row’s in “DataTable” object of<br />

“DataSet” ?<br />

“Datatable” provides “NewRow” method to add new row to “DataTable”.”DataTable”<br />

has “DataRowCollection” object which has all rows in a “DataTable” object.Following<br />

are the methods provided by “DataRowCollection” object :-<br />

187

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!