ADO.NET SqlConnection Class
It is used to establish an open connection to the SQL Server database. It is a sealed class so that cannot be inherited. SqlConnection class uses SqlDataAdapter and SqlCommand classes together to increase performance when connecting to a Microsoft SQL Server database.
Connection does not close explicitly even it goes out of scope. Therefore, you must explicitly close the connection by calling Close() method.
Now, let's create an example that establishes a connection to the SQL Server. We have created a Student database and will use it to connect. Look at the following C# code.
Using block is used to close the connection automatically. We don't need to call close () method explicitly, using block do this for ours implicitly when the code exits the block.
What, if we don't use using block.
If we don't use using block to create connection, we have to close connection explicitly. In the following example, we are using try-block instead of using block.