How can I connect Database in ASP.NET?

Connect Database in ASP.NET:

ASP.NET includes data access tools that make it easier than ever for you to design sites that allow your users to interact with databases through Web Pages. The .NET Framework includes two data providers for accessing enterprise databases:

    i. OLE DB
    ii. SQL Server

To access SQL databases from ASP.NET:
1. Create a database connection using the SqlConnection class.
2. Select a set of records from the database using the SqlDataAdapter class.
3. Fill out a new DataSet using the SqlDataAdapter class.
4. If you’re selecting data from a database for non-interactive display only, it is recommended that you use SqlDataReader for best performance. When using a SqlDataReader select the records using a SqlCommand Query and Create a SqlDataReader that is returned from the SqlCommand object’s ExecuteReader method.
5. Bind a server control, such as DataGrid to the DataSet, SqlDataReader or DataView.