70-516 · Question #253
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server database. You create a DataSet object in the…
The correct answer is C. adapter.TableMappings.Add("Table", "App_Products"). Table Mapping in ADO.NET
Question
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 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 Sub Filifcnx As SqlConnection, ds As DataSet) 02 Dim crod As var = cnx.CreateCorttnand() 03 cmd.CommandText = "SELECT * FROM dbo.Products;" + "SELECT * FROM dbo.Categories" 04 Dim adapter As var = New SqlDataAdapter(cmd) 05 06 End Sub 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 05?
Options
- Aadapter.TableMappings.Add("Products", "App_Products")
- Badapter.Fill(ds, "Products")
- Cadapter.TableMappings.Add("Table", "App_Products")
- Dadapter.Fill(ds.Tables("App_Products"))
How the community answered
(28 responses)- A11% (3)
- B4% (1)
- C82% (23)
- D4% (1)
Explanation
Table Mapping in ADO.NET
Topics
Community Discussion
No community discussion yet for this question.