Which code segment should you add at line 03?

You are creating a Windows Forms application. The application loads a data table named dt from a database and modifies each value in the data table. You add the following code.
(Line numbers are included for reference only.)

01 foreach (DataRow row in dt.Rows) {
02 foreach (DataColumn col in dt.Columns) {
04 Trace.WriteLine(str);
05 }
06 }

You need to format the string named str to show the value of the column at the time the data is loaded and the current value in the column.
Which code segment should you add at line 03?

You are creating a Windows Forms application. The application loads a data table named dt from a database and modifies each value in the data table. You add the following code.
(Line numbers are included for reference only.)

01 foreach (DataRow row in dt.Rows) {
02 foreach (DataColumn col in dt.Columns) {
04 Trace.WriteLine(str);
05 }
06 }

You need to format the string named str to show the value of the column at the time the data is loaded and the current value in the column.
Which code segment should you add at line 03?

A.
string str = String.Format(“Column was {0} is now {1}”, row[col], row[col, DataRowVersion.Current]);

B.
string str = String.Format(“Column was {0} is now {1}”, row[col, DataRowVersion.Default], row[col]);

C.
string str = String.Format(“Column was {0} is now {1}”, row[col], row[col, DataRowVersion.Proposed]);

D.
string str = String.Format(“Column was {0} is now {1}”, row[col, DataRowVersion.Original], row[col]);



Leave a Reply 0

Your email address will not be published. Required fields are marked *