• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Data.SafeDataReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Csla.Data.SafeDataReader的典型用法代码示例。如果您正苦于以下问题:C# SafeDataReader类的具体用法?C# SafeDataReader怎么用?C# SafeDataReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SafeDataReader类属于Csla.Data命名空间,在下文中一共展示了SafeDataReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DataPortal_Fetch

        private void DataPortal_Fetch(CategoryCriteria criteria)
        {
            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return;

            string commandText = String.Format("SELECT [CategoryId], [Name], [Descn] FROM [dbo].[Category] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                            Map(reader);
                        else
                            throw new Exception(String.Format("The record was not found in 'dbo.Category' using the following criteria: {0}.", criteria));
                    }
                }
            }

            OnFetched();
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:25,代码来源:Category.DataAccess.cs


示例2: Fetch

        /// <summary>
        /// Fetch ProfileList.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public ProfileList Fetch(ProfileCriteria criteria)
        {
            ProfileList item = (ProfileList)Activator.CreateInstance(typeof(ProfileList), true);

            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return item;

            // Fetch Child objects.
            string commandText = String.Format("SELECT [UniqueID], [Username], [ApplicationName], [IsAnonymous], [LastActivityDate], [LastUpdatedDate] FROM [dbo].[Profiles] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            do
                            {
                                item.Add(new ProfileFactory().Map(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            MarkOld(item);
            OnFetched();
            return item;
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:38,代码来源:ProfileListFactory.DataAccess.cs


示例3: Child_Fetch

        private void Child_Fetch(ItemCriteria criteria)
        {
            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return;

            RaiseListChangedEvents = false;

            // Fetch Child objects.
            string commandText = String.Format("SELECT [ItemId], [ProductId], [ListPrice], [UnitCost], [Supplier], [Status], [Name], [Image] FROM [dbo].[Item] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));

                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if(reader.Read())
                        {
                            do
                            {
                                this.Add(PetShop.Business.Item.GetItem(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            RaiseListChangedEvents = true;

            OnFetched();
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:34,代码来源:ItemList.DataAccess.cs


示例4: GetPatientChartFilterList

        public static ArrayList GetPatientChartFilterList()
        {
            ArrayList _filterList = new ArrayList();
            using (SqlConnection cn = new SqlConnection(Database.WaldenConnect))
            {
                cn.Open();
                using (SqlCommand cm = cn.CreateCommand())
                {
                    cm.CommandText = "select Name, Description,FilterID"
                        + " from PatientChartFilter"
                        + " where AccountID =" + Common.AccountID
                        + " and FilterId > 0"
                        + " order by Description";

                    using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
                    {
                        while (dr.Read())
                        {
                            _filterList.Add(dr.GetString(0) + "~"
                                + dr.GetString(1) + "~"
                                + dr.GetInt32(2));
                        }
                        return _filterList;
                    }
                }
            }
        }
开发者ID:connecticutortho,项目名称:ct-ortho-repositories4,代码行数:27,代码来源:ChartFilterList.cs


示例5: DataPortal_Fetch

        private void DataPortal_Fetch(OrderCriteria criteria)
        {
            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return;

            string commandText = String.Format("SELECT [OrderId], [UserId], [OrderDate], [ShipAddr1], [ShipAddr2], [ShipCity], [ShipState], [ShipZip], [ShipCountry], [BillAddr1], [BillAddr2], [BillCity], [BillState], [BillZip], [BillCountry], [Courier], [TotalPrice], [BillToFirstName], [BillToLastName], [ShipToFirstName], [ShipToLastName], [AuthorizationNumber], [Locale] FROM [dbo].[Orders] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                            Map(reader);
                        else
                            throw new Exception(String.Format("The record was not found in 'dbo.Orders' using the following criteria: {0}.", criteria));
                    }
                }
            }

            OnFetched();
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:25,代码来源:Order.DataAccess.cs


示例6: DataPortal_Fetch

        private void DataPortal_Fetch(LineItemCriteria criteria)
        {
            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return;

            RaiseListChangedEvents = false;

            // Fetch Child objects.
            string commandText = String.Format("SELECT [OrderId], [LineNum], [ItemId], [Quantity], [UnitPrice] FROM [dbo].[LineItem] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));

                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if(reader.Read())
                        {
                            do
                            {
                                this.Add(PetShop.Tests.ParameterizedSQL.LineItem.GetLineItem(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            RaiseListChangedEvents = true;

            OnFetched();
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:34,代码来源:LineItemList.DataAccess.cs


示例7: DataPortal_Fetch

        private void DataPortal_Fetch(CategoryCriteria criteria)
        {
            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return;

            RaiseListChangedEvents = false;

            // Fetch Child objects.
            string commandText = String.Format("SELECT [CategoryId], [Name], [Descn] FROM [dbo].[Category] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));

                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if(reader.Read())
                        {
                            do
                            {
                                this.Add(PetShop.Business.Category.GetCategory(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            RaiseListChangedEvents = true;

            OnFetched();
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:34,代码来源:CategoryList.DataAccess.cs


示例8: GetDatabaseVersion

 public string GetDatabaseVersion()
 {
     var mySQLString = "Select mdbVersion From tblCaptions";
     if (GetConnection(out _myAccessConn)) return null;
     try
     {
         using (var myAccessCommand = new OleDbCommand(mySQLString, _myAccessConn))
         {
             _myAccessConn.Open();
             using (var dr = new SafeDataReader(myAccessCommand.ExecuteReader()))
             using (dr)
                 while (dr.Read())
                 {
                     _mdbVersion = dr.GetString(dr.GetOrdinal("mdbVersion"));
                 }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error: Failed to retrieve the required data from the DataBase.\n{0}", ex.Message);
         return null;
     }
     finally
     {
         _myAccessConn.Close();
     }
     return _mdbVersion;
 }
开发者ID:gcwolfe007,项目名称:mmMVC_soln,代码行数:28,代码来源:mmDatabaseInfo.cs


示例9: Child_Fetch

        /// <summary>
        /// Retrieves data from the data base into a CSLA editable child business object of type <see cref="Account"/> 
        /// using the criteria provided. 
        /// </summary>
        /// <param name="criteria">Object of type <see cref="AccountCriteria"/></param>
        /// <returns></returns>
        private void Child_Fetch(AccountCriteria criteria)
        {
            bool cancel = false;
            OnChildFetching(criteria, ref cancel);
            if (cancel) return;

            string commandText = String.Format("SELECT [AccountId], [UniqueID], [Email], [FirstName], [LastName], [Address1], [Address2], [City], [State], [Zip], [Country], [Phone] FROM [dbo].[Account] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if(reader.Read())
                            Map(reader);
                        else
                            throw new Exception(String.Format("The record was not found in 'dbo.Account' using the following criteria: {0}.", criteria));
                    }
                }
            }

            OnChildFetched();

        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:32,代码来源:Account.DataAccess.cs


示例10: GetTemplatesList

        public static ArrayList GetTemplatesList(string _templateID)
        {
            ArrayList aTemplates = new ArrayList();
            using (SqlConnection cn = new SqlConnection(Database.WaldenConnect))
            {
                cn.Open();
                using (SqlCommand cm = cn.CreateCommand())
                {
                    cm.CommandText = "SELECT TemplateTextID,AccountID,"
                        + " TemplateID,Text "
                        + " FROM TemplateForChoice"
                        + " where AccountID = " + Common.AccountID
                        + " and TemplateID = " + _templateID
                        + " order by Text";

                    using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
                    {
                        while (dr.Read())
                        {
                            aTemplates.Add(dr["Text"] + "~"
                                + dr["TemplateTextID"]);
                              //  + dr.GetDateTime(1).ToShortDateString() + "~"
                              //  + dr.GetString(2) + "~"
                              //  + dr.GetString(3) + "~"
                              //  + dr.GetInt32(4).ToString());
                        }
                        return aTemplates;
                    }
                }
            }
        }
开发者ID:connecticutortho,项目名称:ct-ortho-repositories4,代码行数:31,代码来源:TemplateLists.cs


示例11: GetTemplates

 public static ArrayList GetTemplates(string _templateType)
 {
     ArrayList aTemplates = new ArrayList();
     using (SqlConnection cn = new SqlConnection(Database.WaldenConnect))
     {
         cn.Open();
         using (SqlCommand cm = cn.CreateCommand())
         {
             cm.CommandText = "select B.Name ,B.TemplateID from TemplateType A,Templates B"
             + " where A.Name = '" + _templateType + "'"
             + " and A.AccountID = " + Common.AccountID
             + " and B.AccountID = " + Common.AccountID
             + " and A.TemplateTypeID = B.TemplateTypeID"
             + " order by B.Name";
             Common.Log(cm.CommandText);
             using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
             {
                 while (dr.Read())
                 {
                     aTemplates.Add(dr.GetString(0) + "~"
                         + dr.GetInt32(1).ToString());
                       //  + dr.GetDateTime(1).ToShortDateString() + "~"
                       //  + dr.GetString(2) + "~"
                       //  + dr.GetString(3) + "~"
                       //  + dr.GetInt32(4).ToString());
                 }
                 return aTemplates;
             }
         }
     }
 }
开发者ID:connecticutortho,项目名称:ct-ortho-repositories4,代码行数:31,代码来源:TemplateLists.cs


示例12: GetStringCollectionOfPatientChart

        public static StringCollection GetStringCollectionOfPatientChart(string _id)
        {
            StringCollection items = new StringCollection();
            using (SqlConnection cn = new SqlConnection(Database.WaldenConnect))
            {
                cn.Open();
                using (SqlCommand cm = cn.CreateCommand())
                {
                    cm.CommandText = "select ScanPath"
                        + " from ScanPatientDocuments"
                        + " where PatientID = " + _id
                        + " and AccountID =" + Common.AccountID
                        + " order by TabId,DateOfService";

                    using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
                    {
                        while (dr.Read())
                        {
                            items.Add(Common.StoreComputer 
                                + Common.StoreShare + dr.GetString(0));
                        }
                        return items;
                    }
                }
            }
        }
开发者ID:connecticutortho,项目名称:ct-ortho-repositories4,代码行数:26,代码来源:ChartList.cs


示例13: DataPortal_Fetch

        private void DataPortal_Fetch(ItemCriteria criteria)
        {
            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return;

            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[CSLA_Item_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    command.Parameters.AddWithValue("@p_ListPriceHasValue", criteria.ListPriceHasValue);
                command.Parameters.AddWithValue("@p_UnitCostHasValue", criteria.UnitCostHasValue);
                command.Parameters.AddWithValue("@p_SupplierHasValue", criteria.SupplierHasValue);
                command.Parameters.AddWithValue("@p_StatusHasValue", criteria.StatusHasValue);
                command.Parameters.AddWithValue("@p_NameHasValue", criteria.NameHasValue);
                command.Parameters.AddWithValue("@p_ImageHasValue", criteria.ImageHasValue);
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if(reader.Read())
                            Map(reader);
                        else
                            throw new Exception(String.Format("The record was not found in 'dbo.Item' using the following criteria: {0}.", criteria));
                    }
                }
            }

            OnFetched();
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:31,代码来源:Item.DataAccess.cs


示例14: Fetch

        /// <summary>
        /// Fetch CartList.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public CartList Fetch(CartCriteria criteria)
        {
            CartList item = (CartList)Activator.CreateInstance(typeof(CartList), true);

            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return item;

            // Fetch Child objects.
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[CSLA_Cart_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if(reader.Read())
                        {
                            do
                            {
                                item.Add(new CartFactory().Map(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            MarkOld(item);
            MarkAsChild(item);
            OnFetched();
            return item;
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:40,代码来源:CartListFactory.DataAccess.cs


示例15: DataPortal_Fetch

        private void DataPortal_Fetch(OrderCriteria criteria)
        {
            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return;

            RaiseListChangedEvents = false;

            // Fetch Child objects.
            string commandText = String.Format("SELECT [OrderId], [UserId], [OrderDate], [ShipAddr1], [ShipAddr2], [ShipCity], [ShipState], [ShipZip], [ShipCountry], [BillAddr1], [BillAddr2], [BillCity], [BillState], [BillZip], [BillCountry], [Courier], [TotalPrice], [BillToFirstName], [BillToLastName], [ShipToFirstName], [ShipToLastName], [AuthorizationNumber], [Locale] FROM [dbo].[Orders] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));

                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if(reader.Read())
                        {
                            do
                            {
                                this.Add(PetShop.Tests.ParameterizedSQL.Order.GetOrder(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            RaiseListChangedEvents = true;

            OnFetched();
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:34,代码来源:OrderList.DataAccess.cs


示例16: Fetch

        /// <summary>
        /// Fetch OrderList.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public OrderList Fetch(OrderCriteria criteria)
        {
            OrderList item = (OrderList)Activator.CreateInstance(typeof(OrderList), true);

            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return item;

            // Fetch Child objects.
            string commandText = String.Format("SELECT [OrderId], [UserId], [OrderDate], [ShipAddr1], [ShipAddr2], [ShipCity], [ShipState], [ShipZip], [ShipCountry], [BillAddr1], [BillAddr2], [BillCity], [BillState], [BillZip], [BillCountry], [Courier], [TotalPrice], [BillToFirstName], [BillToLastName], [ShipToFirstName], [ShipToLastName], [AuthorizationNumber], [Locale] FROM [dbo].[Orders] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            do
                            {
                                item.Add(new OrderFactory().Map(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            MarkOld(item);
            MarkAsChild(item);
            OnFetched();
            return item;
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:39,代码来源:OrderListFactory.DataAccess.cs


示例17: Fetch

        /// <summary>
        /// Fetch CartList.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public CartList Fetch(CartCriteria criteria)
        {
            CartList item = (CartList)Activator.CreateInstance(typeof(CartList), true);

            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return item;

            // Fetch Child objects.
            string commandText = String.Format("SELECT [CartId], [UniqueID], [ItemId], [Name], [Type], [Price], [CategoryId], [ProductId], [IsShoppingCart], [Quantity] FROM [dbo].[Cart] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            do
                            {
                                item.Add(new CartFactory().Map(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            MarkOld(item);
            MarkAsChild(item);
            OnFetched();
            return item;
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:39,代码来源:CartListFactory.DataAccess.cs


示例18: Child_Fetch

        /// <summary>
        /// Retrieves data from the data base into a CSLA editable child business object of type <see cref="Cart"/> 
        /// using the criteria provided. 
        /// </summary>
        /// <param name="criteria">Object of type <see cref="CartCriteria"/></param>
        /// <returns></returns>
        private void Child_Fetch(CartCriteria criteria)
        {
            bool cancel = false;
            OnChildFetching(criteria, ref cancel);
            if (cancel) return;

            string commandText = String.Format("SELECT [CartId], [UniqueID], [ItemId], [Name], [Type], [Price], [CategoryId], [ProductId], [IsShoppingCart], [Quantity] FROM [dbo].[Cart] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if(reader.Read())
                            Map(reader);
                        else
                            throw new Exception(String.Format("The record was not found in 'dbo.Cart' using the following criteria: {0}.", criteria));
                    }
                }
            }

            OnChildFetched();

        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:32,代码来源:Cart.DataAccess.cs


示例19: Child_Fetch

        private void Child_Fetch(CategoryCriteria criteria)
        {
            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return;

            RaiseListChangedEvents = false;

            // Fetch Child objects.
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[CSLA_Category_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    command.Parameters.AddWithValue("@p_NameHasValue", criteria.NameHasValue);
                command.Parameters.AddWithValue("@p_DescnHasValue", criteria.DescriptionHasValue);
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if(reader.Read())
                        {
                            do
                            {
                                this.Add(PetShop.Tests.Collections.EditableChild.Category.GetCategory(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            RaiseListChangedEvents = true;

            OnFetched();
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:35,代码来源:CategoryList.DataAccess.cs


示例20: DataPortal_Fetch

        protected void DataPortal_Fetch(SupplierCriteria criteria)
        {
            bool cancel = false;
            OnFetching(criteria, ref cancel);
            if (cancel) return;

            string commandText = String.Format("SELECT [SuppId], [Name], [Status], [Addr1], [Addr2], [City], [State], [Zip], [Phone] FROM [dbo].[Supplier] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using(var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                            Map(reader);
                        else
                            throw new Exception(String.Format("The record was not found in 'dbo.Supplier' using the following criteria: {0}.", criteria));
                    }
                }
            }

            OnFetched();
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:25,代码来源:Supplier.DataAccess.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Server.DataPortalContext类代码示例发布时间:2022-05-24
下一篇:
C# CsQuery.CQ类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap