Which code segments should you include in Target 1, Target 2, Target 3, Target 4 and Target 5…?

DRAG DROP
You need to update the GetBook() method to retrieve book data by using ADO.NET. You
have the following code:

Which code segments should you include in Target 1, Target 2, Target 3, Target 4 and
Target 5 to complete the code? (To answer, drag the appropriate code segments to the
correct targets in the answer area. Each code segment may be used once, more than once,
or not at all. You may need to drag the split bar between panes or scroll to view content.)

DRAG DROP
You need to update the GetBook() method to retrieve book data by using ADO.NET. You
have the following code:

Which code segments should you include in Target 1, Target 2, Target 3, Target 4 and
Target 5 to complete the code? (To answer, drag the appropriate code segments to the
correct targets in the answer area. Each code segment may be used once, more than once,
or not at all. You may need to drag the split bar between panes or scroll to view content.)

Answer:



Leave a Reply 6

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


FigArt

FigArt

I think target 2 should be “SELECT id, name FROM Books WHERE id = @id” – including the @ symbol as this is the syntax in SQL for declaring a parameter

Venkatesh

Venkatesh

Target1 = “SELECT id, name FROM Books WHERE id = @id”
Target4 = Id=reader.GetInt32(reader.GetOrdinal(“id”)) and
Target5 = reader.GetString(reader.GetOrdinal(“name”))

Because Id is int data type and not GUID.

Venkatesh

Venkatesh

Sorry, Target2 = “SELECT id, name FROM Books WHERE id = @id”

salman

salman

+1 to Venkatesh