Irwsoft Data Framework

Sorting colums (ORDER syntax)
Brief Information
EditionsAll Editions
TopicsSorting column using order by syntax.

This sample will show how to sorting columns in select query in Irwsoft Data Framework.

Example : We want to display all records of Person table that sort by FirstName column and descending order.

     SELECT P1.* FROM PERSON P1 ORDER BY P1.FirstName DESC

C# code
// Declare and initiate a new instance PersonTable.
PersonTable person = new PersonTable();

SqlSelectFrom select = new SqlSelectFrom(person);
// Don’t forget to set connection string !
// NOTE : it is optional if the data-schema class using default connection.

select.ConnectionString = "...";  // [OPTIONAL]

// NOTE : if you not specify the column, all columns will be included !
select.Columns.All(person);  // [OPTIONAL]

// Set order by FirstName descending
select.Order.By(person.FirstName, Irwsoft.Data.SortOrder.Descending);

// Execute the query and return DataView instance that provide properties and methods to access data
// Note : DataView provide paging feature.

Irwsoft.Data.DataView dv = select.Execute();


Related Topics :

Irwsoft Data Ultimate Edition provides comprehensive features of Irwsoft Data Framework and support from irwsoft.