You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database. You must retrieve a connection string.
Which of the following is the correct connection string?
A.
string connectionString = ConfigurationSettings.AppSettings[“connectionString”];
B.
string connectionString = ConfigurationManager.AppSettings[“connectionString”];
C.
string connectionString = ApplicationManager.ConnectionStrings[“connectionString”];
D.
string connectionString = ConfigurationManager.ConnectionStrings[“connectionString”].ConnectionString;
Explanation:
CHAPTER 2 ADO.NET Connected Classes
Lesson 1: Connecting to the Data Store
Storing the Connection String in the Application Configuration File (page 75)