Zbiór zmian 267 dla trunk

Pokaż
Ignoruj:
Data:
2009-01-30 09:48:15 (17 years ago)
Autor:
marek
Opis:

fixes #69 - dodano nowa funkcje GetDataBaseInfo? do klasy ConnString?

Lokalizacja:
trunk/BazaReklam
Pliki:
2 zmodyfikowane

Legenda:

Bez zmian
Dodane
Usunięte
  • trunk/BazaReklam/About.cs

    r266 r267  
    11using System; 
    2 using System.Data.SqlClient; 
    32using System.Windows.Forms; 
    43 
     
    1514            lblVersion.Text = Application.ProductVersion; 
    1615 
    17             SqlConnection sqlConnection = new SqlConnection(ConnString.getConnString().Value); 
    18  
    19             lblDB.Text = sqlConnection.DataSource + "/" + sqlConnection.Database; 
    20             sqlConnection.Dispose(); 
     16            lblDB.Text = ConnString.GetDataBaseInfo(); 
    2117        } 
    2218 
  • trunk/BazaReklam/Classes/ConnString.cs

    r65 r267  
    1 using System; 
    2 using System.Collections.Generic; 
    3 using System.Text; 
     1using System.Data.SqlClient; 
    42 
    53namespace Baza_Reklam 
     
    108 
    119        public string Value 
    12          { 
    13              get { return this.value; } 
    14              set { this.value = value; }  
    15          } 
     10        { 
     11            get { return value; } 
     12            set { this.value = value; } 
     13        } 
    1614 
    1715        private static ConnString connectionString; 
    1816 
    19         private ConnString() {  
     17        private ConnString() 
     18        { 
    2019        } 
    2120 
    2221        public static ConnString getConnString() 
    2322        { 
    24             if (connectionString == null){ 
     23            if (connectionString == null) 
     24            { 
    2525                connectionString = new ConnString(); 
    26             }  
     26            } 
    2727            return connectionString; 
    28         }  
     28        } 
     29 
     30        public static string GetDataBaseInfo() 
     31        { 
     32            SqlConnection sqlConnection = null; 
     33            try 
     34            { 
     35                sqlConnection = new SqlConnection(getConnString().Value); 
     36                return sqlConnection.DataSource + "/" + sqlConnection.Database; 
     37            } 
     38            catch 
     39            { 
     40                return string.Empty; 
     41            } 
     42            finally 
     43            { 
     44                if (sqlConnection != null) sqlConnection.Dispose(); 
     45            } 
     46        } 
    2947    } 
    3048}