Microsoft
70-516 · Question #43
70-516 Question #43: Real Exam Question with Answer & Explanation
Sign in or unlock 70-516 to reveal the answer and full explanation for question #43. The question stem and answer options stay visible for context.
Question
The database contains a table named Categories. The Categories table has a primary key identity column named CategoryID. The application inserts new records by using the following stored procedure. CREATE PROCEDURE dbo.InsertCategory @CategoryName nvarchar(15), @Identity int OUT AS INSERT INTO Categories (CategoryName) VALUES(@CategoryName) SET @Identity = SCOPE_IDENTITY() RETURN @@ROWCOUNT You write the following code segment. SqlDataAdapter adapter = new SqlDataAdapter("SELECT categoryID, CategoryName FROM dbo.Categories",connection); adapter.InsertCommand = new SqlCommand("dbo.InsertCategory", connection); adapter.InsertCommand.CommandType = commandType.StoredProcedure; adapter.InsertCommand.Parameters.Add(new SqlParameter("@CategoryName", SqlDbType.NVarChar, 15,"CategoryName")); You need to retrieve the identity value for the newly created record. Which code segment should you add?
Options
- ASqlParameter parameter =
- BSqlParameter parameter =
- CSqlParameter parameter =
- DSqlParameter parameter =
Unlock 70-516 to see the answer
You've previewed enough free 70-516 questions. Unlock 70-516 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.