MCSD.NET - 70-306 Exam Question:
Download Questions PDF

Suppose You develop a Windows-based application XYZiApp by using Visual Studio .NET. XYZiApp uses
a SqlConnection object for database access.
You typically run XYZiApp on a computer that has limited RAM and hard disk space. After the
code finishes using the SqlConnection object, you must ensure that the connection is closed and
that any resources consumed by the object are released immediately.
What should you do?
A. Call the Finalize method of the SqlConnection object.
B. Call the Dispose method of the SqlConnection object.
C. Set the SqlConnection object equal to Nothing.
D. Set the SqlConnection object equal to

Answer:

B. Call the Dispose method of the SqlConnection object.

Download MCSD.NET - 70-306 Exam Interview Questions And Answers PDF

Previous QuestionNext Question
Suppose You develop a Windows-based application XYZ App by using Visual Studio .NET. XYZApp
implements ADO.NET objects to call Microsoft SQL Server stored procedures. Your database
administrator is responsible for coding and maintaining all stored procedures. Periodically, the
administrator modifies the stored procedures.
At run time, your application code must discover any changes in the way that values are passed
to and returned from the stored procedures.
Which ADO.NET object and method should you use?
A. CommandBuilder.RefreshSchema
B. CommandBuilder.DeriveParameters
C. SqlCommand.CreateParameter
D. SqlDataAdapter.GetFillParameters
Suppose You execute a query on your external Oracle database named XYZSalesDate by using an
OleDbCommand object. The query uses the Average function to return a single value that
represents the average price of products in the inventory table. You want to optimize performance
when you execute this query.
To execute this query from your ADO.NET code, you need to use a method of the
OleDbCommand object. Which method should you use?
A. ExecuteNonQuery
B. ExecuteScalar
C. ToString
D. ExecuteReader