nerdexam
Microsoft

70-516 · Question #237

70-516 Question #237: Real Exam Question with Answer & Explanation

The correct answer is C. Dim parameter = New ObjectParameter("text", text & "%"). Entity SQL supports two variants of the SELECT clause. The first variant, row select, is identified by the SELECT keyword, and can be used to specify one or more values that should be projected Because a row wrapper is implicitly added around the values returned, the result of th

Question

You are developing a new feature that displays an auto-complete list to users as they type color names. You have an existing ContosoEntities context object named context. To support the new feature you must develop code that will accept a string object named text containing a users partial input and will query the Colors database table to retrieve all color names that begin with that input. You need to create an Entity SQL (ESQL) query to meet the requirement. The query must not be vulnerable to a SQL injection attack. Which code segment should you use?

Options

  • ADim parameter = New ObjectParameter
  • BDim parameter = New ObjectParameter("text", text & "%")
  • CDim parameter = New ObjectParameter("text", text & "%")
  • DDim parameter = New ObjectParameter("text", text & "%")

Explanation

Entity SQL supports two variants of the SELECT clause. The first variant, row select, is identified by the SELECT keyword, and can be used to specify one or more values that should be projected Because a row wrapper is implicitly added around the values returned, the result of the query expression is always a multiset of rows. Each query expression in a row select must specify an alias. If no alias is specified,Entity SQL attempts to generate an alias by using the alias generation rules. The other variant of the SELECT clause, value select, is identified by the SELECT VALUE keyword. It allows only one value to be specified, and does not add a row wrapper. A row select is always expressible in terms of VALUE SELECT, as illustrated in the following

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice