- Data:
- 2009-01-30 09:48:15 (17 years ago)
- Lokalizacja:
- trunk/BazaReklam
- Pliki:
-
- 2 zmodyfikowane
-
About.cs (zmodyfikowane) (2 diffs)
-
Classes/ConnString.cs (zmodyfikowane) (2 diffs)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
trunk/BazaReklam/About.cs
r266 r267 1 1 using System; 2 using System.Data.SqlClient;3 2 using System.Windows.Forms; 4 3 … … 15 14 lblVersion.Text = Application.ProductVersion; 16 15 17 SqlConnection sqlConnection = new SqlConnection(ConnString.getConnString().Value); 18 19 lblDB.Text = sqlConnection.DataSource + "/" + sqlConnection.Database; 20 sqlConnection.Dispose(); 16 lblDB.Text = ConnString.GetDataBaseInfo(); 21 17 } 22 18 -
trunk/BazaReklam/Classes/ConnString.cs
r65 r267 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 1 using System.Data.SqlClient; 4 2 5 3 namespace Baza_Reklam … … 10 8 11 9 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 } 16 14 17 15 private static ConnString connectionString; 18 16 19 private ConnString() { 17 private ConnString() 18 { 20 19 } 21 20 22 21 public static ConnString getConnString() 23 22 { 24 if (connectionString == null){ 23 if (connectionString == null) 24 { 25 25 connectionString = new ConnString(); 26 } 26 } 27 27 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 } 29 47 } 30 48 }
