Imported Upstream version 3.12.0

Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
Jo Shields
2015-01-13 10:44:36 +00:00
parent 8b9b85e7f5
commit 181b81b4a4
659 changed files with 12743 additions and 16300 deletions

View File

@@ -56,6 +56,7 @@ using System.Xml;
#if NET_2_0
using System.Collections.Generic;
#endif
using System.Security;
namespace System.Data.SqlClient
{
@@ -93,6 +94,9 @@ namespace System.Data.SqlClient
// The connection string that identifies this connection
string connectionString;
// The connection credentials
SqlCredential credentials;
// The transaction object for the current transaction
SqlTransaction transaction;
@@ -133,6 +137,12 @@ namespace System.Data.SqlClient
ConnectionString = connectionString;
}
public SqlConnection (string connectionString, SqlCredential cred)
{
ConnectionString = connectionString;
Credentials = cred;
}
#endregion // Constructors
#region Properties
@@ -155,6 +165,15 @@ namespace System.Data.SqlClient
}
}
public SqlCredential Credentials {
get {
return credentials;
}
set {
credentials = value;
}
}
#if !NET_2_0
[DataSysDescription ("Current connection timeout value, 'Connect Timeout=X' in the ConnectionString.")]
#endif
@@ -563,6 +582,16 @@ namespace System.Data.SqlClient
if (!tds.IsConnected) {
try {
if (Credentials != null) {
if (parms.User != String.Empty)
throw new ArgumentException("UserID already specified");
if (parms.PasswordSet)
throw new ArgumentException("Password already specified");
if (parms.DomainLogin != false)
throw new ArgumentException("Cannot use credentials with DomainLogin");
parms.User = Credentials.UserId;
parms.Password = Credentials.Password;
}
tds.Connect (parms);
} catch {
if (pooling)
@@ -879,7 +908,10 @@ namespace System.Data.SqlClient
break;
case "password" :
case "pwd" :
parms.Password = value;
parms.Password = new SecureString();
foreach (char c in value)
parms.Password.AppendChar(c);
parms.PasswordSet = true;
break;
case "persistsecurityinfo" :
case "persist security info" :