private int GetCount(string sql)
{
string key = "Statistics: " + sql;
// store this in the cache. Use the sql as part of the key
string cnt = (string)Framework.Utilities.Cache.FetchObject(key);
if (String.IsNullOrEmpty(cnt))
{
using (SqlDataReader sqldr = this.GetSQLDataReader("ProfilesDB", sql, CommandType.Text, CommandBehavior.CloseConnection, null))
{
if (sqldr.Read())
{
cnt = sqldr[0].ToString();
Framework.Utilities.Cache.Set(key, cnt);
}
}
}
return Convert.ToInt32(cnt);
}