nerdexam
GIAC

GSSP-NET · Question #379

John works as a Web developer for HiTech Inc. He develops an application named MyApp by using Visual C# .NET. John uses a SQL Server database. He writes the following code: OleDbCommand cmd = new…

The correct answer is B. Use a SqlCommand object instead of an OleDbCommand object. F. Use a stored procedure instead of the CommandText property. See the full explanation below for the reasoning.

Question

John works as a Web developer for HiTech Inc. He develops an application named MyApp by using Visual C# .NET. John uses a SQL Server database. He writes the following code:

OleDbCommand cmd = new OleDbCommand(); cmd.CommandText = "UPDATE Employees SET Rank = 'Senior' WHERE Basic > 10000"; cmd.ExecuteNonQuery(); Now he wants to improve the performance of the program code. Which of the following actions will he perform to accomplish the task? Each correct answer represents a complete solution. Choose all that apply.

Options

  • AUse a Cache object to execute the program code.
  • BUse a SqlCommand object instead of an OleDbCommand object.
  • CUse the Prepare method on the OleDbCommand object before executing the program code.
  • DUse an OleDbDataReader object to execute the program code.
  • EUse database indexing.
  • FUse a stored procedure instead of the CommandText property.

How the community answered

(65 responses)
  • A
    6% (4)
  • B
    75% (49)
  • C
    3% (2)
  • D
    14% (9)
  • E
    2% (1)

Community Discussion

No community discussion yet for this question.

Full GSSP-NET Practice