User adccms already has more than max_user_connections active connections

Last Reply on Feb 25, 2015 03:26 AM By Azim

Posted on Feb 25, 2015 03:21 AM

Hello sir,

i am geting this error when an product add or edit from the siteadmin.

this error show on public sidealso.

 

User adccms already has more than 'max_user_connections' active connections

Posted on Feb 25, 2015 03:26 AM

You need to close the connection each time when you do some transactions with database.

Or it will be good if you use using blocks for your database transactions.

string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
    using (SqlCommand cmd = new SqlCommand("INSERT INTO Persons(Name, Gender) VALUES(@Name, @Gender)"))
    {
        cmd.Connection = con;
        cmd.Parameters.AddWithValue("@Name", name);
        cmd.Parameters.AddWithValue("@Gender", gender);
        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();
    }
}