Which code segment should you use?

You need to write a code segment that will add a string named strConn to the connection string section of the application configuration file. Which code segment should you use?

You need to write a code segment that will add a string named strConn to the connection string section of the application configuration file. Which code segment should you use?

A.
Dim myConfig As Configuration = _ ConfigurationManager.OpenExeConfiguration( _ ConfigurationUserLevel.None)myConfig.ConnectionStrings.ConnectionStrings.Add( _ New ConnectionStringSettings(“ConnStr1”, strConn))myConfig.Save()

B.
Dim myConfig As Configuration = _ConfigurationManager.OpenExeConfiguration( _
ConfigurationUserLevel.None)myConfig.ConnectionStrings.ConnectionStrings.Add( _ New ConnectionStringSettings(“ConnStr1”, strConn))ConfigurationManager.RefreshSection(“ConnectionStrings”)

C.
ConfigurationManager.ConnectionStrings.Add( _New ConnectionStringSettings(“ConnStr1”, strConn))ConfigurationManager.RefreshSection(“ConnectionStrings”)

D.
ConfigurationManager.ConnectionStrings.Add( New ConnectionStringSettings(“ConnStr1”, strConn))Dim myConfig As Configuration = _ ConfigurationManager.OpenExeConfiguration( _ ConfigurationUserLevel.None)myConfig.Save()



Leave a Reply 0

Your email address will not be published. Required fields are marked *