Guest User

Untitled

a guest
Mar 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3. <connectionStrings>
  4. <add name="my_conn" connectionString="Data Source=xx.xx.xx.xxx;Initial Catalog=some_db;User ID=xxx;Password=yyy" />
  5. </connectionStrings>
  6. </configuration>
  7.  
  8. // Assume failure.
  9. string returnValue = null;
  10.  
  11. // Look for the name in the connectionStrings section.
  12. ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings["my_conn"];
  13.  
  14. // If found, return the connection string.
  15. if (settings != null)
  16. returnValue = settings.ConnectionString;
Add Comment
Please, Sign In to add comment