1. C# / Говнокод #6630

    +120

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    private string GetConnectionString() 
        { 
          string connString = String.Empty; 
          string location = Assembly.GetExecutingAssembly().Location; 
          int pos = location.LastIndexOf('\\'); 
          location = location.Remove(pos); 
          pos = location.LastIndexOf('\\'); 
          location = location.Remove(pos); 
          pos = location.LastIndexOf('\\'); 
          location = location.Remove(pos); 
          location += @"\server\conf\config.conf"; 
          using (StreamReader sr = File.OpenText(location)) 
          { 
            string s = ""; 
            while ((s = sr.ReadLine()) != null) 
            { 
              connString += s; 
            } 
          } 
          connString += "database = ***; charset = utf8;"; 
          return connString; 
        }

    Запостил: mahalex, 11 Мая 2011

    Комментарии (4) RSS

    Добавить комментарий