Cannot implicitly convert type ‘int?’ to ‘int’.
Well you’re casting OrdersPerHour to an int? OrdersPerHour = (int?)dbcommand.ExecuteScalar(); Yet your method signature is int: static int OrdersPerHour(string User) The two have to match. Also a quick suggestion -> Use parameters in your query, something like: string query = “SELECT COUNT(ControlNumber) FROM Log WHERE DateChanged > ? AND User = ? AND Log.EndStatus in … Read more