You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application connects to a Microsoft SQL Server 2005 database.
The application adds data to a table named Customer. The Customer table has a primary key column.
You write the following code segment. (Line numbers are included for reference only.)
01 void ValidateData(DataTable tbl)
02 {
03 tbl.Columns.Add("IsValid", typeof(Boolean));
04 foreach (DataRow item in tbl.Rows)
05 {
06 //Set IsValid to true or false
07 }
08 }
09 DataTable ChangeData()
10 {
11 SqlDataAdapter adp = new SqlDataAdapter();
12 //Setup SqlDataAdapter to get Customer data
13 DataTable tblOriginal = new DataTable();
14 adp.FillSchema(tblOriginal, SchemaType.Source);
15 adp.Fill(tblOriginal);
16 //Change customer details
17 DataTable tblNew = tblOriginal.GetChanges();
18 ValidateData(tblNew);
19
20 return tblOriginal;
21 }
You need to ensure that the ChangeData method returns a DataTable that includes the value in the IsValid column for each row in the Customer table.
Which line of code should you insert at line 19?
A.
tblOriginal.Merge(tblNew, false, MissingSchemaAction.Add);
B.
tblOriginal.Merge(tblNew, true, MissingSchemaAction.Error);
C.
tblOriginal.Merge(tblNew, false, MissingSchemaAction.Ignore);
D.
tblOriginal.Merge(tblNew, true, MissingSchemaAction.AddWithKey);