cybernation989
asked on
Connection Strings
This is not an exam or homework
You have created the following connection string entry in the web.config:
<connectionStrings>
<add name="TestConnectionString " connectionString="Data Source=Test;Datbase=Test;U ID=google; Password=g oogle" providerName="System.Data. SQLClient" />
<connectionStrings>
Which of the following code segments reads the connection string information from the web.config and assigns it to a SQLConnection object?
1.
Imports System.Configuration
Imports System.Data.SqlClient
...
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.Conne ctionStrin gs("TestCo nnectionSt ring")
2.
Imports System.Configuration
Imports System.Data.SqlClient
...
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.Retri eveConnect ionString( "TestConne ctionStrin g")
3.
Imports System.Configuration
Imports System.Data.SqlClient
...
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.GetCo nnectionSt ring("Test Connection String")
4.
Imports System.Configuration
Imports System.Data.SqlClient
...
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.Conne ctionStrin gs("TestCo nnectionSt ring").Con nectionStr ing
You have created the following connection string entry in the web.config:
<connectionStrings>
<add name="TestConnectionString
<connectionStrings>
Which of the following code segments reads the connection string information from the web.config and assigns it to a SQLConnection object?
1.
Imports System.Configuration
Imports System.Data.SqlClient
...
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.Conne
2.
Imports System.Configuration
Imports System.Data.SqlClient
...
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.Retri
3.
Imports System.Configuration
Imports System.Data.SqlClient
...
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.GetCo
4.
Imports System.Configuration
Imports System.Data.SqlClient
...
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.Conne
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
this is funny, why don't you just post the whole exam to save us time
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
rootWebConfig = System.Web.Configuration.W
Dim connString As System.Configuration.Conne
If (0 < rootWebConfig.ConnectionSt
connString = rootWebConfig.ConnectionSt
If Not (Nothing = connString.ConnectionStrin
Console.WriteLine("Northwi
Else
Console.WriteLine("No Northwind connection string")
End If
End If