70-487 question 40 discussion

answered

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.)

Created 8 months, 1 week ago by cabul

cabul

Should be "SELECT id, name FROM Books WHERE id = @id"

mardydacasin

Target 2, target 4 and target 5 is wrong

mikemod1

correct answer: Target 1: conn.Open(); Target 2: "SELECT id, name FROM Books WHERE id = @id"; Target 3: cmd.Parameters.AddWithValue("@id", id); Target 4: Id = reader.GetInt32(reader.GetOrdinal("id")); Target 5: reader.GetString(reader.GetOrdinal("name"));