Asp.net provided functionality to connect to databases and access the data using SQL. In order to create database connectivity in asp.net, SQL server 2005 or MS Access 2007 can be used for the database. A small program code will be required to create the SQL connection to the database and perform database operations. Some knowledge of programming and SQL is essential to create database connectivity in asp.net. Namespace System.Data.SqlClient has to be used to make the connection to a database. The SQL connection is created through the SqlConnection API and operations on the database can be done through SqlCommand API.
SqlConnection con = new SqlConnection("Server=You server name or comp name;Database=Yourdatabasename;Trusted_Connectopn=True");
SqlCommand cmd = new SqlCommand("Write your sql query here eg. select * from Table name");
DataSet ds = new DataSet(cmd,con);
SqlDataAdapter da = new SqlDataAdapter();