/// <summary> /// Shows how to Select all records sorted by column name in either ascending or descending order. /// </summary> private void SelectAllWithSortExpression() { // select all records sorted by Adminid in ascending order string sortBy = "Adminid"; // ascending order //string sortBy = "Adminid desc"; // descending order List <LoginTable> objLoginTableCol = LoginTable.SelectAll(sortBy); }
/// <summary> /// Shows how to Select all records. It also shows how to sort, bind, and loop through records. /// </summary> private void SelectAll() { // select all records List <LoginTable> objLoginTableCol = LoginTable.SelectAll(); // Example 1: you can optionally sort the collection in ascending order by your chosen field objLoginTableCol.Sort(LoginTable.ByPassword); // Example 2: to sort in descending order, add this line to the Sort code in Example 1 objLoginTableCol.Reverse(); // Example 3: directly bind to a GridView - for ASP.NET Web Forms // GridView grid = new GridView(); // grid.DataSource = objLoginTableCol; // grid.DataBind(); // Example 4: loop through all the LoginTable(s) foreach (LoginTable objLoginTable in objLoginTableCol) { int adminid = objLoginTable.Adminid; string password = objLoginTable.Password; } }