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.)
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
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.
+1
+1
Sorry, Target2 = “SELECT id, name FROM Books WHERE id = @id”
+1 to Venkatesh