SqlConnection::ChangePassword Method (String^, SqlCredential^, SecureString^)
Changes the SQL Server password for the user indicated in the SqlCredential object.
Assembly: System.Data (in System.Data.dll)
public: static void ChangePassword( String^ connectionString, SqlCredential^ credential, SecureString^ newSecurePassword )
Parameters
- connectionString
-
Type:
System::String^
The connection string that contains enough information to connect to a server. The connection string should not use any of the following connection string keywords: Integrated Security = true, UserId, or Password; or ContextConnection = true.
- credential
-
Type:
System.Data.SqlClient::SqlCredential^
A SqlCredential object.
- newSecurePassword
-
Type:
System.Security::SecureString^
The new password. newSecurePassword must be read only. The password must also comply with any password security policy set on the server (for example, minimum length and requirements for specific characters).
| Exception | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException | One of the parameters (connectionString, credential, or newSecurePassword) is null. |
Available since 4.5