public viewPageViewCount(System.Int32 _keyID) { if (_keyID > 0) { using (SqlConnection connection = new SqlConnection(Lookups.GetConnString())) { using (SqlCommand Command = new SqlCommand("SELECT [PageID], [SumOfViewCount] From [viewPageViewCount] Where [PageID] = @Key", connection)) { Command.CommandType = CommandType.Text; Command.Parameters.Add(new SqlParameter("@Key", _keyID)); connection.Open(); IDataReader dR = Command.ExecuteReader(); if (dR.Read()) { if (dR[Columns.PageID] == DBNull.Value) { PageID = (System.Int32)dR[Columns.PageID]; } if (dR[Columns.SumOfViewCount] == DBNull.Value) { SumOfViewCount = (System.Int32)dR[Columns.SumOfViewCount]; } } dR.Close(); dR = null; connection.Close(); } } } }