System.Data.SqlClient Namespace
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The System.Data.SqlClient namespace is the .NET Data Provider for SQL Server.
Important
For new development, use Microsoft.Data.SqlClient. This namespace documents the legacy provider for existing applications and .NET Framework-specific scenarios that require it.
Classes
| Name | Description |
|---|---|
| SqlAuthenticationInitializer |
Defines the core behavior of authentication initializers that can be registered in the app.config file and provides a base for derived classes. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlAuthenticationParameters |
Represents AD authentication parameters passed by a driver to authentication providers. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlAuthenticationProvider |
Defines the core behavior of authentication providers and provides a base class for derived classes. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlAuthenticationToken |
Represents an AD authentication token. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlBulkCopy |
Lets you efficiently bulk load a SQL Server table with data from another source. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlBulkCopyColumnMapping |
Defines the mapping between a column in a SqlBulkCopy instance's data source and a column in the instance's destination table. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlBulkCopyColumnMappingCollection |
Collection of SqlBulkCopyColumnMapping objects that inherits from CollectionBase. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlClientFactory |
Represents a set of methods for creating instances of the System.Data.SqlClient provider's implementation of the data source classes. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlClientLogger |
Represents a SQL client logger. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlClientMetaDataCollectionNames |
Provides a list of constants for use with the GetSchema method to retrieve metadata collections. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlClientPermission |
Enables the .NET Framework Data Provider for SQL Server to help make sure that a user has a security level sufficient to access a data source. This API supports .NET Framework code access security. For new database development, use Microsoft.Data.SqlClient; retain this API for applications that require .NET Framework code access security. |
| SqlClientPermissionAttribute |
Associates a security action with a custom security attribute. This API supports .NET Framework code access security. For new database development, use Microsoft.Data.SqlClient; retain this API for applications that require .NET Framework code access security. |
| SqlColumnEncryptionCertificateStoreProvider |
The implementation of the key store provider for Windows Certificate Store. This class enables using certificates stored in the Windows Certificate Store as column master keys. For details, see Always Encrypted. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlColumnEncryptionCngProvider |
The CMK Store provider implementation for using the Microsoft Cryptography API: Next Generation (CNG) with Always Encrypted. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlColumnEncryptionCspProvider |
The CMK Store provider implementation for using Microsoft CAPI based Cryptographic Service Providers (CSP) with Always Encrypted. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlColumnEncryptionEnclaveProvider |
The base class that defines the interface for enclave providers for Always Encrypted. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlColumnEncryptionKeyStoreProvider |
Base class for all key store providers. A custom provider must derive from this class and override its member functions and then register it using SqlConnection.RegisterColumnEncryptionKeyStoreProviders(). For details see, Always Encrypted. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlCommand |
Represents a Transact-SQL statement or stored procedure to execute against a SQL Server database. This class cannot be inherited. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlCommandBuilder |
Automatically generates single-table commands that are used to reconcile changes made to a DataSet with the associated SQL Server database. This class cannot be inherited. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlConnection |
Represents a connection to a SQL Server database. This class cannot be inherited. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlConnectionStringBuilder |
Provides a simple way to create and manage the contents of connection strings used by the SqlConnection class. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlCredential |
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 ( For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlDataAdapter |
Represents a set of data commands and a database connection that are used to fill the DataSet and update a SQL Server database. This class cannot be inherited. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlDataReader |
Provides a way of reading a forward-only stream of rows from a SQL Server database. This class cannot be inherited. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SQLDebugging |
Included to support debugging applications. Not intended for direct use. This API supports legacy .NET Framework debugging and isn't intended for direct use. For new database development, use Microsoft.Data.SqlClient. |
| SqlDependency |
The SqlDependency object represents a query notification dependency between an application and an instance of SQL Server. An application can create a SqlDependency object and register to receive notifications via the OnChangeEventHandler event handler. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlEnclaveAttestationParameters |
Encapsulates the information SqlClient sends to SQL Server to initiate the process of attesting and creating a secure session with the enclave, SQL Server uses for computations on columns protected using Always Encrypted. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlEnclaveSession |
Encapsulates the state of a secure session between SqlClient and an enclave inside SQL Server, which can be used for computations on encrypted columns protected with Always Encrypted. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlError |
Collects information relevant to a warning or error returned by SQL Server. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlErrorCollection |
Collects all errors generated by the .NET Framework Data Provider for SQL Server. This class cannot be inherited. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlException |
The exception that is thrown when SQL Server returns a warning or error. This class cannot be inherited. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlInfoMessageEventArgs |
Provides data for the InfoMessage event. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlNotificationEventArgs |
Represents the set of arguments passed to the notification event handler. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlParameter |
Represents a parameter to a SqlCommand and optionally its mapping to DataSet columns. This class cannot be inherited. For more information on parameters, see Configuring Parameters and Parameter Data Types. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlParameterCollection |
Represents a collection of parameters associated with a SqlCommand and their respective mappings to columns in a DataSet. This class cannot be inherited. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlProviderServices |
The DbProviderServices implementation for the SqlClient provider for SQL Server. Retain this API for the built-in .NET Framework Entity Framework provider. For new database development, see Microsoft.Data.SqlClient. |
| SqlRowsCopiedEventArgs |
Represents the set of arguments passed to the SqlRowsCopiedEventHandler. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlRowUpdatedEventArgs |
Provides data for the RowUpdated event. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlRowUpdatingEventArgs |
Provides data for the RowUpdating event. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlTransaction |
Represents a Transact-SQL transaction to be made in a SQL Server database. This class cannot be inherited. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
Enums
| Name | Description |
|---|---|
| ApplicationIntent |
Specifies a value for ApplicationIntent. Possible values are For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| PoolBlockingPeriod |
Specifies a value for the PoolBlockingPeriod property. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SortOrder |
Specifies how rows of data are sorted. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlAuthenticationMethod |
Describes the different SQL authentication methods that can be used by a client connecting to Azure SQL Database. For details, see Connecting to SQL Database By Using Azure Active Directory Authentication. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlBulkCopyOptions |
Bitwise flag that specifies one or more options to use with an instance of SqlBulkCopy. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlCommandColumnEncryptionSetting |
Specifies how data will be sent and received when reading and writing encrypted columns. Depending on your specific query, performance impact may be reduced by bypassing the Always Encrypted driver's processing when non-encrypted columns are being used. Note that these settings cannot be used to bypass encryption and gain access to plaintext data. For details, see Always Encrypted (Database Engine). For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlConnectionColumnEncryptionSetting |
Specifies that Always Encrypted functionality is enabled in a connection. Note that these settings cannot be used to bypass encryption and gain access to plaintext data. For details, see Always Encrypted (Database Engine). For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlNotificationInfo |
This enumeration provides additional information about the different notifications that can be received by the dependency event handler. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlNotificationSource |
Indicates the source of the notification received by the dependency event handler. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlNotificationType |
Describes the different notification types that can be received by an OnChangeEventHandler event handler through the SqlNotificationEventArgs parameter. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
Delegates
| Name | Description |
|---|---|
| OnChangeEventHandler |
Handles the OnChange event that is fired when a notification is received for any of the commands associated with a SqlDependency object. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlInfoMessageEventHandler |
Represents the method that will handle the InfoMessage event of a SqlConnection. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlRowsCopiedEventHandler |
Represents the method that handles the SqlRowsCopied event of a SqlBulkCopy. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlRowUpdatedEventHandler |
Represents the method that will handle the RowUpdated event of a SqlDataAdapter. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
| SqlRowUpdatingEventHandler |
Represents the method that will handle the RowUpdating event of a SqlDataAdapter. For new development, use Microsoft.Data.SqlClient. This page documents System.Data.SqlClient. |
Remarks
Note
The System.Data.SqlClient APIs are deprecated. For new development, use the Microsoft.Data.SqlClient APIs.
The .NET Data Provider for SQL Server describes a collection of classes used to access a SQL Server database in the managed space. Using the SqlDataAdapter, you can fill a memory-resident DataSet that you can use to query and update the database.
Note
For conceptual information about using this namespace when programming with .NET, see SQL Server and ADO.NET.