Try disposing of your SqlCommand objects:
using (SqlCommand com = new SqlCommand())
{
com.Connection = con;
com.CommandType = CommandType.StoredProcedure;
com.CommandText = "add_data_to_calander";
com.Parameters.AddWithValue("@date", row.Cells[2].Value.ToString());
com.Parameters.AddWithValue("@dayinweek", row.Cells[1].Value.ToString());
com.Parameters.AddWithValue("@dayinyear", row.Cells[0].Value.ToString());
var _value = row.Cells[3].Value;
if (_value != null && (bool)_value)
com.Parameters.AddWithValue("@isdisable", "1");
else
com.Parameters.AddWithValue("@isdisable", "0");
counter++;
if (con.State == ConnectionState.Closed)
con.Open();
com.ExecuteNonQuery();
com.Parameters.Clear();
}
SqlCommands are scarce resources, and the chances are you are running out in SQL server.