Redigeeri

Jagamisviis:


SqlCredential Class

Definition

SqlCredential provides a more secure way to specify the password for a login attempt using SQL Server Authentication.

SqlCredential is comprised of a user id and a password that will be used for SQL Server Authentication. The password in a SqlCredential object is of type SecureString.

SqlCredential cannot be inherited.

Windows Authentication (Integrated Security = true) remains the most secure way to log in to a SQL Server database.

public ref class SqlCredential sealed
public sealed class SqlCredential
type SqlCredential = class
Public NotInheritable Class SqlCredential
Inheritance
SqlCredential

Remarks

Warning

Microsoft does not recommend providing your user name and password directly, because it's an insecure pattern. Where possible, use more secure authentication flows, such as Managed Identities for Azure resources, or Windows authentication for SQL Server.

Constructors

SqlCredential(String, SecureString)

Creates an object of type SqlCredential.

Properties

Password

Gets the password component of the SqlCredential object.

UserId

Gets the user ID component of the SqlCredential object.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also