本文整理汇总了C#中Query.ORDER_BY方法的典型用法代码示例。如果您正苦于以下问题:C# Query.ORDER_BY方法的具体用法?C# Query.ORDER_BY怎么用?C# Query.ORDER_BY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.ORDER_BY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Query_ORDER_BY_ExpressionDESC_Collection
public void Query_ORDER_BY_ExpressionDESC_Collection()
{
Query q = new Query("Products", "Northwind");
DataSet ds = q.ORDER_BY("CategoryID", SqlFragment.DESC).
ORDER_BY("ProductID", SqlFragment.DESC).
ExecuteDataSet();
//should bring 73 as first
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(73));
}
示例2: Query_ORDER_BY_Collection
public void Query_ORDER_BY_Collection()
{
Query q = new Query("Products", "Northwind");
TableSchema.Table ts = DataService.GetTableSchema("Products", "Northwind");
DataSet ds = q.ORDER_BY(ts.GetColumn("SupplierID")).
ORDER_BY(ts.GetColumn("ProductID")).
ExecuteDataSet();
//should bring 2 as first
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(2));
}
示例3: Query_ORDER_BY_DESC_Collection
public void Query_ORDER_BY_DESC_Collection()
{
Query q = new Query("Products", "Northwind");
TableSchema.Table ts = DataService.GetTableSchema("Products", "Northwind");
DataSet ds = q.ORDER_BY(ts.GetColumn("CategoryID"), SqlFragment.DESC).
ORDER_BY(ts.GetColumn("ProductID"), SqlFragment.DESC).
ExecuteDataSet();
//should bring 73 as first
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(73));
}
示例4: QueryExecuteJoinedDataSet_ORDER_BY
public void QueryExecuteJoinedDataSet_ORDER_BY()
{
Query q = new Query("Products", "Northwind");
TableSchema.Table ts = DataService.GetTableSchema("Products", "Northwind");
DataSet ds = q.ORDER_BY(ts.GetColumn("ProductID")).ExecuteJoinedDataSet();
//should bring 1 as first
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(1));
}
示例5: QueryExecuteJoinedDataSet_ORDER_BY_Expression
public void QueryExecuteJoinedDataSet_ORDER_BY_Expression()
{
Query q = new Query("Products", "Northwind");
DataSet ds = q.ORDER_BY("ProductID DESC").ExecuteJoinedDataSet();
//should bring 77 as first
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(77));
}
示例6: Query_ORDER_BY_DESC
public void Query_ORDER_BY_DESC()
{
Query q = new Query("Products", "Northwind");
TableSchema.Table ts = DataService.GetTableSchema("Products", "Northwind");
DataSet ds = q.ORDER_BY(ts.GetColumn("ProductID"), SqlFragment.DESC).ExecuteDataSet();
//should bring 77 as first
//Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(77));
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(77L), "77 != " + ds.Tables[0].Rows[0]["ProductID"].ToString());
}
示例7: Query_PagingTest_View
public void Query_PagingTest_View()
{
Query q = new Query("Sales By Category", "Northwind");
q.PageSize = 10;
q.PageIndex = 1;
q.ORDER_BY("CategoryID", "ASC");
int counter = 0;
using(IDataReader rdr = q.ExecuteReader())
{
while(rdr.Read())
counter++;
rdr.Close();
}
//should bring back all records
Assert.IsTrue(counter == 10, "Nope - it's " + counter);
}
示例8: Acc_QueryExecuteJoinedDataSet_ORDER_BY_DESC
public void Acc_QueryExecuteJoinedDataSet_ORDER_BY_DESC()
{
Query q = new Query("Products", "NorthwindAccess");
TableSchema.Table ts = DataService.GetTableSchema("Products", "NorthwindAccess");
DataSet ds = q.ORDER_BY(ts.GetColumn("ProductID"), SqlFragment.DESC).ExecuteJoinedDataSet();
//should bring 77 as first
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(77));
}
示例9: Acc_Query_JoinedDataSet_OrderByFK
public void Acc_Query_JoinedDataSet_OrderByFK()
{
Query q = new Query("Products", "NorthwindAccess");
TableSchema.Table ts = DataService.GetTableSchema("Products", "NorthwindAccess");
//q.OrderBy = OrderBy.Desc(ts.GetColumn("CategoryID"));
q.ORDER_BY(ts.GetColumn("CategoryID"), "DESC");
q.ORDER_BY(ts.GetColumn("ProductID"), "ASC");
DataSet ds = q.ExecuteJoinedDataSet();
//should bring 10 as first
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(10));
}
示例10: QueryExecuteJoinedDataSet_ORDER_BY_Expression_Collection
public void QueryExecuteJoinedDataSet_ORDER_BY_Expression_Collection()
{
Query q = new Query("Products", "Northwind");
DataSet ds = q.ORDER_BY("SupplierID DESC").
ORDER_BY("ProductID DESC").
ExecuteJoinedDataSet();
//should bring 48 as first
//Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(48));
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(48L), "48 != " + ds.Tables[0].Rows[0]["ProductID"].ToString());
}
示例11: LoadLogLevels
/// <summary>
/// Loads the log levels.
/// </summary>
private void LoadLogLevels()
{
Query query = new Query(Log.Schema.TableName);
query.QueryType = QueryType.Select;
query.SelectList = Log.Columns.MessageType;
query.DISTINCT();
query.ORDER_BY(Log.Columns.MessageType);
IDataReader reader = query.ExecuteReader();
while (reader.Read()) {
ddlLogLevel.Items.Add(new ListItem(Enum.Parse(typeof(Logger.LogMessageType), reader[0].ToString()).ToString(), reader[0].ToString()));
}
ddlLogLevel.Items.Insert(0, new ListItem(LocalizationUtility.GetText("lblSelect")));
}
示例12: QueryExecuteJoinedDataSet_ORDER_BY_Collection
public void QueryExecuteJoinedDataSet_ORDER_BY_Collection()
{
Query q = new Query("Products", "Northwind");
TableSchema.Table ts = DataService.GetTableSchema("Products", "Northwind");
DataSet ds = q.ORDER_BY(ts.GetColumn("SupplierID")).
ORDER_BY(ts.GetColumn("ProductID")).
ExecuteJoinedDataSet();
//should bring 38 as first (SupplierID is replaced by CompanyName)
//Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(38)); // 38 != 2
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(2L), "2 != " + ds.Tables[0].Rows[0]["ProductID"].ToString());
}
示例13: Query_ORDER_BY_Expression_Collection
public void Query_ORDER_BY_Expression_Collection()
{
Query q = new Query("Products", "Northwind");
DataSet ds = q.ORDER_BY("CategoryID DESC").
ORDER_BY("ProductID DESC").
ExecuteDataSet();
//should bring 73 as first
//Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(73));
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(73L), "73 != " + ds.Tables[0].Rows[0]["ProductID"].ToString());
}
示例14: QueryExecuteJoinedDataSet_ORDER_BY_ExpressionDESC
public void QueryExecuteJoinedDataSet_ORDER_BY_ExpressionDESC()
{
Query q = new Query("Products", "Northwind");
DataSet ds = q.ORDER_BY("ProductID", SqlFragment.DESC).ExecuteJoinedDataSet();
//should bring 77 as first
//Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(77));
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(77L), "77 != " + ds.Tables[0].Rows[0]["ProductID"].ToString());
}
示例15: QueryExecuteJoinedDataSet_ORDER_BY_DESC_Collection
public void QueryExecuteJoinedDataSet_ORDER_BY_DESC_Collection()
{
Query q = new Query("Products", "Northwind");
TableSchema.Table ts = DataService.GetTableSchema("Products", "Northwind");
DataSet ds = q.ORDER_BY(ts.GetColumn("SupplierID"), SqlFragment.DESC).
ORDER_BY(ts.GetColumn("ProductID"), SqlFragment.DESC).
ExecuteJoinedDataSet();
//should bring 48 as first (SupplierID is replaced by CompanyName)
Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(48));
}