1
Q:
A) MessageBox.Show(?Total is: ? + cmd.Parameters[?@Output?].Value.ToString()); | B) MessageBox.Show(?Total is: ? + cmd.Parameters[?@Output?].ToString()); |
C) MessageBox.Show(?Total is: ? + cmd.Parameters[?@ItemTotal? | D) MessageBox.Show(?Total is: ? + cmd.Parameters[?@ItemTotal? |
Answer: C) MessageBox.Show(?Total is: ? + cmd.Parameters[?@ItemTotal?
Explanation:
Explanation:
The @ItemTotal parameter is declared as an output parameter with SQL Server data type INT.We use the Value property of the SQLParameter class to retrieve the value of this parameter. We must also convert the INT value to a string value with the ToString method. We then supply this string to the MessageBox.Show method.
Incorrect Answers
Option A, B:
The @ItemTotal parameter is the output parameter. Using @Output this way is incorrect. Output is a keyword and no variable named @Output has been declared.
Option D:
We must use the Value method to retrieve the value of the parameter..