Showing alert panel when inventory reaches critical <p>I'm trying to show when an inventory is lower than critical. It doesn't seem to get there when I debug the system </p> <p>This is my code behind </p> <pre><code>protected void Page_Load(object sender, EventArgs e) { GetInventory(); TotalCount(); CriticalItem(); Panel1.Visible = false; } void TotalCount() { con.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = "SELECT 'Total Count of Inventory ' + '(' + convert(nvarchar,SUM(Quantity)) + ')' AS TotalCount from Inventory"; SqlDataReader data = cmd.ExecuteReader(); if (data.HasRows) { while (data.Read()) { lblTotalCount.Text = data["TotalCount"].ToString(); } con.Close(); } else { con.Close(); Response.Redirect("Default.aspx"); } } void GetInventory() { con.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = "SELECT Inventory.InventoryID, Products.ProductName, " + "Supplier.SupplierName, Inventory.Quantity, Users.LastName + ', ' + Users.FirstName AS UserAccount, " + "SupplierProducts.CriticalLevel, Inventory.Status, Inventory.DateAdded, Inventory.DateModified, SupplierProducts.Price FROM Inventory " + "INNER JOIN SupplierProducts ON Inventory.ProductID = SupplierProducts.SupplierProductID " + "INNER JOIN Products ON SupplierProducts.ProductID = Products.ProductID " + "INNER JOIN Supplier ON Inventory.SupplierID = Supplier.SupplierID " + "INNER JOIN Users ON Inventory.UserID = Users.UserID"; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "Inventory"); lvInventory.DataSource = ds; lvInventory.DataBind(); con.Close(); } void CriticalItem() { var intcheck = new DataTable(); using (var da = new SqlDataAdapter("SELECT * FROM Inventory", con)) { da.Fill(intcheck); } var critcheck = new DataTable(); using (var da = new SqlDataAdapter("SELECT * FROM SupplierProducts", con)) { da.Fill(critcheck); } int finalQuantity = Convert.ToInt32(intcheck.Rows[0]["Quantity"]); int criticalLevel = Convert.ToInt32(critcheck.Rows[0]["CriticalLevel"]); if (finalQuantity &gt; criticalLevel) { Panel1.Visible = true; criticalItem.Text = "Available"; } } </code></pre> <p>I want to criticalItem.text to tell the Inventory that is less than its critical level.</p>