dotConnect for SQL Server Documentation
Devart.Common Namespace / SelectStatement Class / OrderBy Property
Example

In This Topic
OrderBy Property
In This Topic
Contains list of columns used in the ORDER BY clause of the current SelectStatement object.
Syntax
'Declaration
 
Public ReadOnly Property OrderBy As SelectColumnCollection
 

Property Value

A SelectColumnCollection that represents list of columns used in the ORDER BY clause.
Example
The following example demonstrates how to use the OrderBy property.
SqlSelectStatement stmt = new SqlSelectStatement();
SelectColumn empName = new SelectColumn("ENAME");
stmt.Columns.Add(empName);
stmt.Tables.Add(new SelectTable("emp"));

stmt.OrderBy.Add(empName);

//select ENAME from emp order by ENAME
SqlCommand command = new SqlCommand(stmt.ToString());
Dim stmt As New SqlSelectStatement
Dim empName As New SelectColumn("ENAME")
stmt.Columns.Add(empName)
stmt.Tables.Add(New SelectTable("emp"))

stmt.OrderBy.Add(empName)

'select ENAME from emp order by ENAME
Dim command5 As New SqlCommand(stmt.ToString)
See Also