Represents an open connection to a SQL Server database.
SqlConnection
is a class in .Net's System.Data.SqlClient
library that represents a connection between the local machine and a SQL Server database.
The connection can be configured using its ConnectionString
property, and must be opened before use (and closed or disposed after use). ADO.NET also implements pooling for the internal connection used by SqlConnection
, so calling Open
is relatively cheap.
ADO.NET does not provide thread safety for SqlConnection
, nor any of the objects that use it (such as SqlCommand
or SqlDataReader
) - these objects should be used on the same thread as the SqlConnection
, and by only one thread at once.
For more information on SqlConnection, see its MSDN page: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx