[?xmlversion="1.0"encoding="utf-8"?]
[configuration]
[connectionStrings]
[addname="MyDatabase"connectionString="Data Source=server;Initial Catalog=database;
User ID=userid;Password=password"providerName="System.Data.SqlClient"/][/connectionStrings]
[appSettings>[addkey="SomeSetting"value="Value1"/]
[addkey="SomeOtherSetting"value="Value2"/]
[/appSettings]
[/configuration] To access the connection string you use this code:
[configuration]
[connectionStrings]
[addname="MyDatabase"connectionString="Data Source=server;Initial Catalog=database;
User ID=userid;Password=password"providerName="System.Data.SqlClient"/][/connectionStrings]
[appSettings>[addkey="SomeSetting"value="Value1"/]
[addkey="SomeOtherSetting"value="Value2"/]
[/appSettings]
[/configuration] To access the connection string you use this code:
Dim myConnString AsString = ConfigurationManager.ConnectionStrings("MyDatabase")Be sure to add a reference to System.Configuration.dll and add Imports System.Configuration to your code.
No comments:
Post a Comment