Answer C

Explanation: We want to produce an attribute list with no tags.

The WriteSchema XmlWriteMode writes the current contents of the DataSet as XML data with the relational structure as inline XML Schema as is required in this scenario.


.NET Framework Class Library, MappingType Enumeration

.NET Framework Developer's Guide, Writing a DataSet as XML Data [Visual Basic] NET Framework Class Library. DataSet.WriteXml Method [Visual Basic]

Incorrect Answers

All the other proposed solutions are inadequate since they would produce a tagged output:




You are developing a Windows-based application that logs hours worked by your employees. Your design goals require you to maximize application performance and minimize impact on server resources. You need to implement a SqlCommand object that will send a SQL INSERT action query to a database each time a user makes a new entry.

To create a function named LineltemInser, you write the following code: (Line numbers are included for reference only.)

01 Function LineItemInsert(ByVal empid As Integer, _

02 ByVal projectID As Integer, ByVal hrs As Decimal, _

03 ByVal cnn As SqlConnection) As Integer

04 Dim SQL As String

05 Dim Ret As Integer

06 SQL = "INSERT INTO TimeEntries " & _

07 "(EmpID, ProjectID, Hours) VALUES " & _

08 "(" & empID & projectID & ", " & hrs & ") "

09 Dim cmd As New SqlCommand(SQL, cnn)

11 'Insert new code.

13 End Function

Your code must execute the SQL INSERT action query and verify the number of database records that are affected by the query.

Which code segment should you add on line 11?

Ret = Cmd.ExecuteNonQuery()


Return Ret

Ret = cmd.ExecuteScalar()


Return Ret

C. Dim reader as SqlDataReader cnn.Open()

reader = cmd.ExecuteReader() cnn.Close()

Return reader.RecordsAffected

D. Dim reader As SqlDataReader cnn.Open()

reader = cmd.ExecuteReader() cnn.Close()

Return reader.GetValue()

Answer: A

Explanation: The SqlCommand.ExecuteNonQuery Method Executes a Transact-SQL statement against the Connection and returns the number of rows affected. This is the most effective solution.

0 0

Post a comment