PrepAway - Latest Free Exam Questions & Answers

Which two actions should you perform?

You are developing an application that includes the following code segment. (Line numbers
are included for reference only.)

The GetAnimals() method must meet the following requirements:
Connect to a Microsoft SQL Server database.
Create Animal objects and populate them with data from the database.
Return a sequence of populated Animal objects.
You need to meet the requirements.
Which two actions should you perform? (Each correct answer presents part of the solution.
Choose two.)

PrepAway - Latest Free Exam Questions & Answers

A.
Insert the following code segment at line 16:
while (sqlDataReader.NextResult())

B.
Insert the following code segment at line 13:
sqlConnection.BeginTransaction();

C.
Insert the following code segment at line 13:
sqlConnection.Open();

D.
Insert the following code segment at line 16:
while (sqlDataReader.Read())

E.
insert the following code segment at line 16:
while (sqlDataReader.GetValues())

5 Comments on “Which two actions should you perform?

  1. Dip says:

    Answer is C and D.
    Reason is:
    The connection object was initialized but it needs to be opened in order to execute any SQL query.
    After executing, Read() method is used for fetching the each values.




    2



    0

Leave a Reply