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


C# DataAccessLayer.GetDataReader方法代码示例

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


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

示例1: DisplayRecord

        public ClientMasterInfo DisplayRecord(IModelObject KeyObject)
        {
            string sqlString = string.Empty;

            sqlString = "SELECT clm_iRecID," + Environment.NewLine;
            sqlString += "clm_cClientNum," + Environment.NewLine;
            sqlString += "clm_cEnglishName," + Environment.NewLine;
            sqlString += "clm_cChinaName," + Environment.NewLine;
            sqlString += "clm_cTaxNumber," + Environment.NewLine;
            sqlString += "clm_cLinkman," + Environment.NewLine;
            sqlString += "clm_cAddress," + Environment.NewLine;
            sqlString += "clm_cPhone," + Environment.NewLine;
            sqlString += "clm_cFax," + Environment.NewLine;
            sqlString += "clm_cWebSite," + Environment.NewLine;
            sqlString += "clm_cRemark," + Environment.NewLine;
            sqlString += "clm_cAdd," + Environment.NewLine;
            sqlString += "clm_dAddDate," + Environment.NewLine;
            sqlString += "clm_cLast," + Environment.NewLine;
            sqlString += "clm_dLastDate " + Environment.NewLine;
            sqlString += " FROM ClientMaster_clm " + Environment.NewLine;
            sqlString += " WHERE clm_iRecID=" + KeyObject.RecordID.ToString();

            DataAccessLayer dal = new DataAccessLayer();
            ClientMasterInfo clientMaster = null;
            SqlDataReader dr = null;

            try
            {
                dr = dal.GetDataReader(sqlString);

                if (dr != null)
                {
                    if (dr.Read())
                    {
                        clientMaster = GetRecord(dr);
                    }
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }

            return clientMaster;
        }
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:52,代码来源:ClientMasterDA.cs

示例2: GetRecordForSql

        private ClientMasterInfo GetRecordForSql(string sql)
        {
            LocalLayer.LocalDefine localDefine = new DAL.SqlDAL.LocalLayer.LocalDefine();
            string sqlString = string.Empty;

            DataAccessLayer dal = new DataAccessLayer();
            ClientMasterInfo clientMaster = null;
            SqlDataReader dr = null;

            try
            {
                dr = dal.GetDataReader(sql);
                if (dr != null)
                {
                    if (dr.Read())
                    {
                        clientMaster = GetRecord(dr);
                    }
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }

            return clientMaster;
        }
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:34,代码来源:ClientMasterDA.cs

示例3: SearchRecords

        public List<ClientMasterInfo> SearchRecords(ClientMasterInfo clientMasterInfo)
        {
            string sqlString = string.Empty;
            string whereString = string.Empty;

            sqlString = "SELECT TOP 100 clm_iRecID,"+Environment.NewLine;
            sqlString+="clm_cClientNum,"+Environment.NewLine;
            sqlString+="clm_cEnglishName,"+Environment.NewLine;
            sqlString+="clm_cChinaName,"+Environment.NewLine;
            sqlString += "clm_cTaxNumber," + Environment.NewLine;
            sqlString+="clm_cLinkman,"+Environment.NewLine;
            sqlString+="clm_cAddress,"+Environment.NewLine;
            sqlString+="clm_cPhone,"+Environment.NewLine;
            sqlString+="clm_cFax,"+Environment.NewLine;
            sqlString+="clm_cWebSite,"+Environment.NewLine;
            sqlString+="clm_cRemark,"+Environment.NewLine;
            sqlString+="clm_cAdd,"+Environment.NewLine;
            sqlString+="clm_dAddDate,"+Environment.NewLine;
            sqlString+="clm_cLast,"+Environment.NewLine;
            sqlString+="clm_dLastDate "+Environment.NewLine;
            sqlString+=" FROM ClientMaster_clm ";

            if (clientMasterInfo != null)
            {
                whereString = " WHERE 1=1 ";
                if (clientMasterInfo.ClmCClientNum.Trim().Length > 0)
                {
                    whereString += " AND clm_cClientNum='" + clientMasterInfo.ClmCClientNum.Trim().Replace("'","''")+"'";
                }
                if (clientMasterInfo.ClmCChinaName.Trim().Length > 0)
                {
                    //whereString += " AND clm_cChinaName LIKE N'" + General.ReplaceSQLLikeCondition(clientMasterInfo.ClmCChinaName.Trim().Replace("'", "''")) + "'";
                }
            }

            sqlString += whereString;

            DataAccessLayer dal = new DataAccessLayer();
            List<ClientMasterInfo> clientMasterInfoList=null;
            SqlDataReader dr = null;

            try
            {
                dr = dal.GetDataReader(sqlString);

                if (dr != null)
                {
                    clientMasterInfoList = new List<ClientMasterInfo>();
                    ClientMasterInfo cmInfo = null;
                    while (dr.Read())
                    {
                        cmInfo = GetRecord(dr);
                        clientMasterInfoList.Add(cmInfo);
                    }
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }

            return clientMasterInfoList;
        }
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:70,代码来源:ClientMasterDA.cs


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