Which code segment should you insert at line 05?

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 uses a strongly typed DataSet named Products. The Products DataSet contains the following objects:

Two DataTables named Product and Retailer
A DataRelation named RetailerProduct

The DataRelation named RetailerProduct relates the Product DataTable to the Retailer DataTable.
A stored procedure named GetRetailerProducts returns two resultsets that contain the following two lists respectively:

A list of retailers
A list of products by each retailer

You write the following code segment. (Line numbers are included for reference only.)

01 Products dsProducts = new Products();
02 using (SqlDataAdapter da = new
03 SqlDataAdapter()){
04 da.SelectCommand = "GetRetailerProducts";
05
06 da.Fill(dsProducts);
07 }

You need to ensure that the resultsets from the stored procedure are correctly loaded into the DataTables.

Which code segment should you insert at line 05?

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 uses a strongly typed DataSet named Products. The Products DataSet contains the following objects:

Two DataTables named Product and Retailer
A DataRelation named RetailerProduct

The DataRelation named RetailerProduct relates the Product DataTable to the Retailer DataTable.
A stored procedure named GetRetailerProducts returns two resultsets that contain the following two lists respectively:

A list of retailers
A list of products by each retailer

You write the following code segment. (Line numbers are included for reference only.)

01 Products dsProducts = new Products();
02 using (SqlDataAdapter da = new
03 SqlDataAdapter()){
04 da.SelectCommand = "GetRetailerProducts";
05
06 da.Fill(dsProducts);
07 }

You need to ensure that the resultsets from the stored procedure are correctly loaded into the DataTables.

Which code segment should you insert at line 05?

A.
da.TableMappings.Add("Table", "Retailer");
da.TableMappings.Add("Table1", "Product");

B.
da.TableMappings.Add("Table1", "Retailer");
da.TableMappings.Add("Table2", "Product");

C.
da.TableMappings.Add("Table", "Retailer");
da.TableMappings.Add("Table1", "RetailerProduct");

D.
da.TableMappings.Add("Table", "RetailerProduct");
da.TableMappings.Add("Table1", "RetailerProduct");



Leave a Reply 0

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