Hope you are asking about how to set-up a connection to sql server 2005 through C# in Asp.net. If so Check the below code...
<connectionStrings>
<add name="OsmEmpConString" connectionString="Data Source=.\sqlexpress;Initial Catalog=AgentDB; User ID= Sqluser ; Password= Change123;"
providerName="System.Data.SqlClient" />
</connectionStrings>
Create the connection in web.config file and establish a connection
DataSource = Your database source
Initial Catalog = Database name
User ID = User id of the database
Password = Password to the database
Use that connection in your .cs file... You can check the below code
string strDbCon = WebConfigurationManager.ConnectionStrings["OsmEmpConString"].ToString();
SqlConnection _cnAgentDB = new SqlConnection(strDbCon);
_cnAgentDB.Open();
_cnAgentDB is the instance of SqlConnection.
Before going to do this, u need to add two namespaces in the .cs file,
they are
using System.Web.Configuration;
using System.Data.SqlClient;