@@ -1016,6 +1016,33 @@ public virtual string ReplaceKeyword(string data, string keyword, string newKeyw
10161016 res . Append ( newKeyword ) ;
10171017 res . Append ( '=' ) ;
10181018 res . Append ( prop [ 1 ] ) ;
1019+ res . Append ( ';' ) ;
1020+ }
1021+ else
1022+ {
1023+ res . Append ( s ) ;
1024+ res . Append ( ';' ) ;
1025+ }
1026+ }
1027+ }
1028+ return res . ToString ( ) ;
1029+ }
1030+ public virtual string ReplaceKeyValue ( string data , string keyword , string newValue )
1031+ {
1032+ char [ ] sep = { ';' } ;
1033+ StringBuilder res = new StringBuilder ( "" ) ;
1034+ string [ ] props = data . Split ( sep ) ;
1035+ foreach ( string s in props )
1036+ {
1037+ if ( s != null && s . Length > 0 )
1038+ {
1039+ string [ ] prop = s . Split ( '=' ) ;
1040+ if ( prop != null && prop . Length == 2 && prop [ 0 ] . Trim ( ) . Equals ( keyword , StringComparison . OrdinalIgnoreCase ) )
1041+ {
1042+ res . Append ( keyword ) ;
1043+ res . Append ( '=' ) ;
1044+ res . Append ( newValue ) ;
1045+ res . Append ( ';' ) ;
10191046 }
10201047 else
10211048 {
@@ -1066,21 +1093,19 @@ public string GetParameterValue(string conStr, string searchParam)
10661093 return string . Empty ;
10671094 else
10681095 {
1069-
1070- int posBegin = 0 ;
1071- int posEnd = 0 ;
10721096 string paramVal = string . Empty ;
10731097
1074- posBegin = conStr . IndexOf ( searchParam , StringComparison . OrdinalIgnoreCase ) ;
1098+ int posBegin = conStr . IndexOf ( searchParam , StringComparison . OrdinalIgnoreCase ) ;
10751099 if ( posBegin > - 1 )
10761100 {
10771101
10781102 posBegin += searchParam . Length + 1 ;
1103+ int posEnd ;
10791104 if ( conStr . LastIndexOf ( ';' ) > posBegin )
1080-
1105+
10811106 posEnd = conStr . IndexOf ( ';' , posBegin ) ;
10821107 else
1083-
1108+
10841109 posEnd = conStr . Length ;
10851110
10861111 paramVal = conStr . Substring ( posBegin , ( posEnd - posBegin ) ) ;
@@ -1570,6 +1595,8 @@ public class GxSqlServer : GxDataRecord
15701595 private int MAX_CREATE_TRIES = 3 ;
15711596 private const int MILLISECONDS_BETWEEN_RETRY_ATTEMPTS = 500 ;
15721597 private const string MULTIPLE_DATAREADERS = "MultipleActiveResultSets" ;
1598+ private const string INTEGRATED_SECURITY = "Integrated Security" ;
1599+ private const string INTEGRATED_SECURITY_NO = "no" ;
15731600
15741601 private bool multipleDatareadersEnabled ;
15751602
@@ -1992,6 +2019,14 @@ private bool UserIdAllowed(SqlConnectionStringBuilder sqlConnectionString)
19922019 else
19932020 return true ;
19942021 }
2022+ private string ResolveConnectionStringAuthentication ( string extra , SqlConnectionStringBuilder sqlConnectionString )
2023+ {
2024+ if ( sqlConnectionString != null && sqlConnectionString . Authentication != SqlAuthenticationMethod . NotSpecified && sqlConnectionString . IntegratedSecurity )
2025+ {
2026+ return ReplaceKeyValue ( extra , INTEGRATED_SECURITY , INTEGRATED_SECURITY_NO ) ;
2027+ }
2028+ return extra ;
2029+ }
19952030#endif
19962031 protected override string BuildConnectionString ( string datasourceName , string userId ,
19972032 string userPassword , string databaseName , string port , string schema , string extra )
@@ -2020,6 +2055,7 @@ protected override string BuildConnectionString(string datasourceName, string us
20202055 {
20212056 connectionString . AppendFormat ( ";Password={0}" , userPassword ) ;
20222057 }
2058+ extra = ResolveConnectionStringAuthentication ( extra , additionalConnectionString ) ;
20232059#else
20242060 if ( userId != null )
20252061 {
0 commit comments