PrepAway - Latest Free Exam Questions & Answers

What should you do to display changes to the database as they happen without polling the database?

You are creating a Windows Forms application. The application displays data from a Microsoft SQL Server 2005 database in a DataGridView control. The DataGridView control is populated by a data table. The data table is filled by using a SqlDataAdapter object. You need to display changes to the database as they happen without polling the database. What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Create a SqlDependency object and bind it to a SqlCommand object that is used by the SqlDataAdapter object.
Reload the dataset in an event handler,
that is registered for the OnChanged event of the SqlDependency object.

B.
Use a TransactionScope block
when calling the Fill method of the SqlDataAdapter object.

C.
Set the CommandTimeout property of the SqlCommand object that is used by the SqlDataAdapter object to -1.

D.
Reload the data table in an event handler that is registered for the RowChanging event of the DataTable object.


Leave a Reply