//order History by input protected void PopulatePointsSystemOrder(string orderBy) { try { ClearGridView(); sqlConnection = dbConn.MakeConnection(sqlConnection); sqlConnection.Open(); string sql = "SELECT c.fileNumber, c.childName, c.childSurname, a.activityDate, a.activityDescription, p.allocatedPointValue, p.reasonForPoints FROM tbl_Points p, tbl_Activity a, tbl_Child c WHERE p.fileNumber = c.fileNumber AND p.activityID = a.activityID order by '" + orderBy; SqlDataAdapter sqlCmd = new SqlDataAdapter(sql, sqlConnection); sqlCmd.Fill(dtbl); if (dtbl.Rows.Count > 0) { PointsSystemGridView.DataSource = dtbl; PointsSystemGridView.DataBind(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { sqlConnection.Close(); } }
protected void ClearGridView() { PointsSystemGridView.DataSource = null; PointsSystemGridView.DataBind(); }