70-516 · Question #119
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…
Sign in or unlock 70-516 to reveal the answer and full explanation for question #119. The question stem and answer options stay visible for context.
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");
Unlock 70-516 to see the answer
You've previewed enough free 70-516 questions. Unlock 70-516 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.