Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3. <appSettings>
  4. <add key="MyKey" value="MyValue"/>
  5. </appSettings>
  6. <connectionStrings>
  7. <add name ="MyHost"
  8. providerName="System.Data.Sql"
  9. connectionString="Data Source=(local)SQLEXPRESS;Initial Catalog=Northwind;
  10. Integrated Security = true; User ID=Admin;Password=P@ssw0rd;
  11. Connection Timeout=2;Encrypt=True;TrustServerCertificate=True" />
  12. </connectionStrings>
  13. </configuration>
  14.  
  15. ConnectionStringSettingsCollection settings = ConfigurationManager.ConnectionStrings;
  16. if(settings != null)
  17. MessageBox.Show(settings[0].ConnectionString, "ConnectionString");
  18.  
  19. string s = ConfigurationManager.AppSettings["MyKey"];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement