public void TotalBikeType() { TBikeDAL MyDAL = new TBikeDAL(); DataTable ResultTableBike = MyDAL.ShowAllBikeTable(); int i = 0; int TotalCount = 0; string MostBookBike = ""; string BicycleName = ""; //get total Booking for a type---- WORKING PROCESS foreach (DataRow Row in ResultTableBike.Rows) { string BicycleType = Convert.ToString(ResultTableBike.Rows[i]["BicycleType"]); DataTable ResultTable = MyDAL.SelectBookingByMonthType(BicycleType, datebymonth); int MaxCounter = 0; foreach (DataRow row in ResultTable.Rows) { BicycleName = Convert.ToString(ResultTable.Rows[MaxCounter]["BicycleType"]); MaxCounter++; } if (TotalCount < MaxCounter) { TotalCount = MaxCounter; MostBookBike = BicycleName; } i++; } TBBookType.Text = MostBookBike; }