You create an application by using the Microsoft .NET Framework version 3.5. You use Microsoft ADO.NET to access the data for the application.
The application connects to a Microsoft SQL Server 2005 database that has a table named Customer. A secondary Microsoft Office Access database also has a table named Customer. Both the tables have the same schema. The data in the Access database is updated frequently.
You write the following code segment. (Line numbers are included for reference only.)
01 SqlConnection con = new SqlConnection();
02 //Setup con
03 string sql = "Select * from Customer";
04 SqlDataAdapter adp = new SqlDataAdapter(sql, con);
05 SqlCommandBuilder bld = new SqlCommandBuilder(adp);
06 DataTable tblCust = new DataTable();
07 adp.FillSchema(tblCust,SchemaType.Source);
08 adp.Fill(tblCust);
09 OleDbConnection conAc = new OleDbConnection();
10 OleDbCommand cmd = new OleDbCommand(sql, conAc);
11 //Setup conAc
12 conAc.Open();
13 IDataReader rd = cmd.ExecuteReader();
14
15 conAc.Close();
16 adp.Update(tblCust);
You need to merge the data from the Customer table of the Access database to the Customer table of the SQL Server 2005 database.
Which code segment should you insert at line 14?
A.
tblCust.Merge(rd.GetSchemaTable());
B.
tblCust.Load(rd, LoadOption.Upsert);
C.
tblCust.Load(rd, LoadOption.PreserveChanges);
D.
tblCust.Load(rd, LoadOption.OverwriteChanges);