当前位置: 首页>>代码示例>>C#>>正文


C# Query.ExecuteJoinedDataSet方法代码示例

本文整理汇总了C#中Query.ExecuteJoinedDataSet方法的典型用法代码示例。如果您正苦于以下问题:C# Query.ExecuteJoinedDataSet方法的具体用法?C# Query.ExecuteJoinedDataSet怎么用?C# Query.ExecuteJoinedDataSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Query的用法示例。


在下文中一共展示了Query.ExecuteJoinedDataSet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Query_JoinedDataSet_OrderByCollection

        public void Query_JoinedDataSet_OrderByCollection()
        {
            Query q = new Query("Products", "Northwind");
            TableSchema.Table ts = DataService.GetTableSchema("Products", "Northwind");
            q.OrderByCollection.Add(OrderBy.Desc(ts.GetColumn("CategoryID")));
            q.OrderByCollection.Add(OrderBy.Desc(ts.GetColumn("ProductID")));

            DataSet ds = q.ExecuteJoinedDataSet();

            //should bring 73 as first
            Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(73));
        }
开发者ID:BlackMael,项目名称:SubSonic-2.0,代码行数:12,代码来源:QueryTest.cs

示例2: Query_JoinedDataSet

        public void Query_JoinedDataSet()
        {
            Query q = new Query("Products", "Northwind");
            DataSet ds = q.ExecuteJoinedDataSet();

            //should bring back all records
            Assert.IsTrue(ds.Tables[0].Columns["SupplierID"].DataType == typeof(string));
        }
开发者ID:BlackMael,项目名称:SubSonic-2.0,代码行数:8,代码来源:QueryTest.cs

示例3: Query_JoinedDataSet_OrderByFK

        public void Query_JoinedDataSet_OrderByFK()
        {
            Query q = new Query("Products", "Northwind");
            TableSchema.Table ts = DataService.GetTableSchema("Products", "Northwind");
            q.OrderBy = OrderBy.Desc(ts.GetColumn("CategoryID"));
            DataSet ds = q.ExecuteJoinedDataSet();

            //should bring 10 as first
            Assert.IsTrue(ds.Tables[0].Rows[0]["ProductID"].Equals(10L), "10 != " + ds.Tables[0].Rows[0]["ProductID"].ToString());
        }
开发者ID:howgoo,项目名称:SubSonic-2.0,代码行数:10,代码来源:QueryTest.cs

示例4: 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));
        }
开发者ID:RyanDansie,项目名称:SubSonic-2.0,代码行数:12,代码来源:QueryTest.cs

示例5: BindGrid

    private void BindGrid(string orderBy)
    {
        //TableSchema.Table schema = DataService.GetTableSchema(tableName, providerName);
        if (Schema != null && Schema.PrimaryKey != null)
        {
            SetTableName(Schema);
            Query query = new Query(Schema);

            string sortColumn = null;
            if(!String.IsNullOrEmpty(orderBy))
            {
                sortColumn = orderBy;
            }
            else if(ViewState[ORDER_BY] != null)
            {
                sortColumn = (string)ViewState[ORDER_BY];
            }

            int colIndex = -1;

            if (!String.IsNullOrEmpty(sortColumn))
            {
                ViewState.Add(ORDER_BY, sortColumn);
                TableSchema.TableColumn col = Schema.GetColumn(sortColumn);
                if(col == null)
                {
                    for (int i = 0; i < Schema.Columns.Count; i++)
                    {
                        TableSchema.TableColumn fkCol = Schema.Columns[i];
                        if(fkCol.IsForeignKey && !String.IsNullOrEmpty(fkCol.ForeignKeyTableName))
                        {
                            TableSchema.Table fkTbl = DataService.GetSchema(fkCol.ForeignKeyTableName, ProviderName, TableType.Table);
                            if(fkTbl != null)
                            {
                                col = fkTbl.Columns[1];
                                colIndex = i;
                                break;
                            }
                        }
                    }
                }
                if(col != null && col.MaxLength < 2048)
                {
                    if (ViewState[SORT_DIRECTION] == null || ((string)ViewState[SORT_DIRECTION]) == SqlFragment.ASC)
                    {
                        if (colIndex > -1)
                        {
                            query.OrderBy = OrderBy.Asc(col, SqlFragment.JOIN_PREFIX + colIndex);
                        }
                        else
                        {
                            query.OrderBy = OrderBy.Asc(col);
                        }
                        ViewState[SORT_DIRECTION] = SqlFragment.ASC;
                    }
                    else
                    {
                        if (colIndex > -1)
                        {
                            query.OrderBy = OrderBy.Desc(col, SqlFragment.JOIN_PREFIX + colIndex);
                        }
                        else
                        {
                            query.OrderBy = OrderBy.Desc(col);
                        }
                        ViewState[SORT_DIRECTION] = SqlFragment.DESC;
                    }
                }
            }

            DataTable dt = query.ExecuteJoinedDataSet().Tables[0];
            grid.DataSource = dt;
            grid.AutoGenerateColumns = false;
            grid.Columns.Clear();

            HyperLinkField link = new HyperLinkField();
            link.Text = "Edit";
            link.DataNavigateUrlFields = new string[] { Schema.PrimaryKey.ColumnName };
            link.DataNavigateUrlFormatString = HttpContext.Current.Request.CurrentExecutionFilePath + "?id={0}";
            grid.Columns.Insert(0, link);

            for (int i = 0; i < Schema.Columns.Count; i++ )
            {

                BoundField field = new BoundField();
                field.DataField = dt.Columns[i].ColumnName;
                field.SortExpression = dt.Columns[i].ColumnName;
                //field.SortExpression = Utility.QualifyColumnName(Schema.Name, dt.Columns[i].ColumnName, Schema.ProviderType);
                field.HtmlEncode = false;
                if (Schema.Columns[i].IsForeignKey)
                {
                    TableSchema.Table schema;
                    if(Schema.Columns[i].ForeignKeyTableName == null)
                    {
                        schema = DataService.GetForeignKeyTable(Schema.Columns[i], Schema);
                    }
                    else
                    {
                        schema = DataService.GetSchema(Schema.Columns[i].ForeignKeyTableName, ProviderName, TableType.Table);
                    }
//.........这里部分代码省略.........
开发者ID:hondoslack,项目名称:territorysite,代码行数:101,代码来源:AutoScaffold.aspx.cs


注:本文中的Query.ExecuteJoinedDataSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。