Online Access Free 070-516 Practice Test
Exam Code: | 070-516 |
Exam Name: | TS: Accessing Data with Microsoft .NET Framework 4 |
Certification Provider: | Microsoft |
Free Question Number: | 196 |
Posted: | Aug 25, 2025 |
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You create a stored procedure to insert a new record in the Categories table according to following code
segment.
CREATE PROCEDURE dbo.InsertCategory @CategoryName navrchar(15),
@Identity int OUT
AS INSERT INTO Categories(CategoryName) VALUES (@CategoryName) SET @Identity = SCOPE_IDENTITY() RETURN @@ROWCOUNT
You add the following code fragment. (Line numbers are included for reference only.)
01 private static void ReturnIdentity(string connectionString)
02 {
03 using(SqlConnection connection = new SqlConnection(connectionString))
04 {
05 SqlDataAdpater adapter = new SqlDataAdapter("SELECT CategoryID,
CategoryName FROM dbo.Categories", connection);
06 adapter.InsertCommand = new SqlCommand("InsertCategory", connection);
07 adapter.InsertCommand.CommandType = CommandType.StoredProcedure;
08 SqlParameter rowcountParameter = adapter.InsertCommand.Parameters.Add
("@RowCount", SqlDbType.Int);
09 ...
10 adapter.InsertCommand.Parameters.Add("@CategoryName", SqlDbType.NChar,
15, "CategoryName");
11 SqlParameter identityParameter = adapter.InsertCommand.Parameters.Add
("@Identity", SqlDbType.Int, 0, "CategoryID");
12 ...
13 DataTable categories = new DataTable();
14 adapter.Fill(categories);
15 DataRow ctegoryRow = categories.NewRow();
16 categoryRow["CategoryName"] = "New beverages";
17 categories.Rows.Add(categoryRow);
18 adapter.Update(categories);
19 Int32 rowCount = (Int32)adapter.InsertCommand.Parameters
["@RowCount"].Value;
20 }
21 }
Which code elements needs to be added in the empty lines?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application. A file named books.xml contains the following XML.
<bib>
<book title="Programming in Unix" year="1992">
<author>Author1</author>
<author>Author2</author>
<author> Author 3 </author>
</book> </bib>
The application must generate an XML result that contains an XML element named BookTitle for each
book. The text content of the element must contain the title of the book.
You need to create a query that generates the new XML result. What should you do?
You use Microsoft Visual Studio 2010 and .NET Framework 4.0 to develop an application that uses the Entity Data Model for the fallowing database tables.
You need to ensure that the entity that is mapped to the ContectTypeDerived table derives from the entity that is mapped to the ContentTypeBase table. What should you do?
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that
connects to a Microsoft SQL Server 2008 database.
You use the ADO.NET Entity Framework Designer to model entities. You add the following stored
procedure to the database, and you add a function import to the model.
CREATE PROCEDURE [dbo].[InsertDepartment] @Name nvarchar(50), @ID int NULL OUTPUT
AS INSERT INTO Department (Name) VALUES (@Name) SELECT @ID = SCOPE_IDENTITY()
You need to insert a new department and display the generated ID. Which code segment should you use?