GSSP-.NET · Question #19
(Topic 1) 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…
The correct answer is D. Use a SqlCommand object instead of an OleDbCommand object. E. Use a stored procedure instead of the CommandText property. See the full explanation below for the reasoning.
Question
- (Topic 1)
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 database indexing.
- BUse an OleDbDataReader object to execute the program code.
- CUse a Cache object to execute the program code.
- DUse a SqlCommand object instead of an OleDbCommand object.
- EUse a stored procedure instead of the CommandText property.
- FUse the Prepare method on the OleDbCommand object before executing the program
How the community answered
(37 responses)- A3% (1)
- B3% (1)
- C11% (4)
- D78% (29)
- F5% (2)
Community Discussion
No community discussion yet for this question.