Which code segment should you insert at line 05?

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?

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?

A.
adapter.TableMappings.Add(“Products”, “App_Products”)
adapter.TableHappings.Add(“Categories”, “App_Categories”)
adapter.Fill(ds)

B.
adapter.Fill(ds, “Products”)
adapter.Fill(ds, “Categories”)

C.
adapter.TableMappings.Add(“Table”, “App_Products”) adapter.TableMappings.Add(“Tablel”,
“App_Categories”)
adapter.Fill(ds)

D.
adapter.Fill(ds.Tables(“App_Products”))
adapter.Fill(ds.Tables(“App Categories”))

Explanation:

Table Mapping in ADO.NET
(http://msdn.microsoft.com/en-us/library/ms810286.aspx)



Leave a Reply 0

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