FillByWhereClause() public method

public FillByWhereClause ( Category dataTable, string whereClause, System parameters ) : int
dataTable Category
whereClause string
parameters System
return int
コード例 #1
0
ファイル: ProductFamily.cs プロジェクト: Sage/SData-Contracts
        public override List<Identity> GetAll(NorthwindConfig config, string whereExpression, OleDbParameter[] oleDbParameters)
        {
            #region Declarations
            List<Identity> result = new List<Identity>();
            int recordCount = 0;
            Category dataset = new Category();
            #endregion

            // get the first 11 rows of the changelog
            using (OleDbConnection connection = new OleDbConnection(config.ConnectionString))
            {
                CategoriesTableAdapter tableAdapter;

                tableAdapter = new CategoriesTableAdapter();

                tableAdapter.Connection = connection;

                if (string.IsNullOrEmpty(whereExpression))
                    recordCount = tableAdapter.Fill(dataset.Categories);
                else
                    recordCount = tableAdapter.FillByWhereClause(dataset.Categories, whereExpression, oleDbParameters);
            }

            foreach (Category.CategoriesRow row in dataset.Categories.Rows)
            {
                // use where expression !!
                result.Add(new Identity(this.EntityName, row.CategoryID.ToString()));
            }

            return result;
        }