nerdexam
Microsoft

70-516 · Question #119

70-516 Question #119: Real Exam Question with Answer & Explanation

The correct answer is D. adapter.TableMappings.Add("Products", "App_Products");. Table Mapping in ADO.NET

Question

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. You create a DataSet object in the application. You add two DataTable objects named App_Products and App_Categories to the DataSet. You add the following code segment to populate the DataSet object. (Line numbers are included for reference only.) 01 public void Fill(SqlConnection cnx, DataSet ds) 02 { 03 var cmd = cnx.CreateCommand(); 04 cmd.CommandText = "SELECT * FROM dbo.Products; " + "SELECT * FROM dbo.Categories"; 05 var adapter = new SqlDataAdapter(cmd); 06 ... 07 } You need to ensure that App_Products and App_Categories are populated from the dbo.Products and dbo.Categories database tables. Which code segment should you insert at line 06?

Options

  • Aadapter.Fill(ds, "Products");
  • Badapter.Fill(ds.Tables["App_Products"]);
  • Cadapter.TableMappings.Add("Table", "App_Products");
  • Dadapter.TableMappings.Add("Products", "App_Products");

Explanation

Table Mapping in ADO.NET

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework... | 70-516 Q#119 Answer | NerdExam