fork download
  1. using System;
  2.  
  3. public static class Program {
  4. public static void Main() {
  5. DAL.DadosConexao.isServ = true;
  6. var con = DAL.DadosConexao.StringConexao;
  7. }
  8. }
  9.  
  10. namespace DAL {
  11. public static class DadosConexao {
  12. public static string servidor { get; set; }
  13. public static bool isServ { get; set; }
  14.  
  15. public static string StringConexao {
  16. get {
  17. if (!isServ) servidor = Environment.MachineName.ToString();
  18. return "Data Source=" + servidor +
  19. "\\MINHAINSTANCIA;" +
  20. "Initial Catalog=MINHABASE;" +
  21. "Persist Security Info=True;" +
  22. "User ID=sa;" +
  23. "Password=123456";
  24. }
  25. }
  26. }
  27. }
  28.  
  29. //https://pt.stackoverflow.com/q/93033/101
Success #stdin #stdout 0.01s 13948KB
stdin
Standard input is empty
stdout
Standard output is empty