I have made connection string in web.config file.
<connectionStrings>
<add name="Test_registration"
connectionString="Data Source=DOTNET\SA;Initial Catalog=Test2009;User ID=trainee;Password=trainee123"
providerName="System.Data.SqlClient"/>
</connectionStrings>
And in CS file make a constructor for opening a connection.
public main_connection()
{
sql_conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Test_registration"].ConnectionString);
sql.conn.open();
}
But I am getting connection pooling error at runtime of the program on server.
Can anyone tell me where I should close the connection? In web.config file of my project cs file where i open the connection?
I want to write that close() statement only one time as I start the connection only one time.
set connection string here.
then use following code. ( sql_conn is the name of connection object)