15 |
|
try |
16 |
|
{ |
17 |
|
string connetionString = null; |
18 |
< |
connetionString = string.Format(@"Data Source={0}\{1};;AttachDbFilename=|DataDirectory|\{2};Integrated Security=SSPI", DBServerAddress, DBServerInstance, DBDatabase); |
18 |
> |
connetionString = GetConnectionString(); |
19 |
|
connection = new SqlConnection(); |
20 |
|
connection.ConnectionString = connetionString; |
21 |
|
} |
22 |
|
//catch (SqlException ex) { Console.WriteLine(ex.ToString()); ErrorInfo = ex; throw ErrorInfo;} |
23 |
|
catch (Exception ex) { Console.WriteLine(ex.ToString()); ErrorInfo = ex; throw ErrorInfo; } |
24 |
|
} |
25 |
+ |
|
26 |
+ |
new public static string GetConnectionString() |
27 |
+ |
{ |
28 |
+ |
return string.Format(@"Data Source={0}\{1};;AttachDbFilename=|DataDirectory|\{2};Integrated Security=SSPI", DBServerAddress, DBServerInstance, DBDatabase); |
29 |
+ |
} |
30 |
|
} |
31 |
|
} |