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


C# Database.ExecuteCommandReader方法代码示例

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


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

示例1: DeleteUser

        public void DeleteUser(int id)
        {
            try
            {
                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {
                    db.Open();
                    string sql;
                    int ret = 0;
                    DataTable oTable = new DataTable();
                    sql = "DeleteFromTable";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@tablename", "@id", "@updatedby" },
                        new DbType[] { DbType.String, DbType.Int32, DbType.String },
                        new object[] { "Withdrawals", id, appUsr.UserName },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:25,代码来源:WithdrawalService.cs

示例2: GetLoanedForUser

        public DataTable GetLoanedForUser(int userId)
        {
            try
            {

                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {
                    db.Open();
                    string sql;
                    int ret = 0;
                    DataTable oTable = new DataTable();
                    sql = "Dashboard_GetLoanedForUser";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@id" },
                        new DbType[] { DbType.Int32 },
                        new object[] { userId },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                    return oTable;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:27,代码来源:DashboardService.cs

示例3: Authenticate

        public UserEntity Authenticate(string systemID, string password)
        {
            try
            {

                UserEntity user = new UserEntity();
                int ret = 0;
                DataTable oTable = new DataTable();

                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {
                    db.Open();

                    string sql = "AuthenticateUser";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@username", "@password" },
                        new DbType[] { DbType.String, DbType.String },
                        new object[] { systemID, password },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                    if (oTable.Rows.Count > 0)
                    {
                        DataRow oRow = oTable.Rows[0];
                        user = SetData(oRow);

                    }
                }

                return user;
            }
            catch (Exception ex) { throw ex; }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:32,代码来源:UserService.cs

示例4: DoesCutoffExist

        public bool DoesCutoffExist(int id, int loan_id, DateTime loandate)
        {
            try
            {
                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {
                    db.Open();
                    string sql;
                    int ret = 0;
                    DataTable oTable = new DataTable();
                    sql = "DoesCutoffExist";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@loanid", "@id", "@date" },
                        new DbType[] { DbType.Int32, DbType.Int32, DbType.Date },
                        new object[] { loan_id, id, loandate },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                    if (oTable.Rows.Count > 0) { return true; }

                    return false;
                }
            }
            catch (Exception ex) { throw ex; }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:24,代码来源:PayableService.cs

示例5: GetAll

        public DataView GetAll(string query, int type)
        {
            try
            {
                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {

                    db.Open();
                    int ret = 0;
                    DataTable oTable = new DataTable();
                    string sql = "GetWithdrawals";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@query" },
                        new DbType[] { DbType.String },
                        new object[] { query },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                    return Utility.FilterDataTable(FormalFormatTable(oTable), "type=" + type.ToString());

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:27,代码来源:WithdrawalService.cs

示例6: GetOne

        public WithdrawalEntity GetOne(int userId)
        {
            try
            {

                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {
                    db.Open();
                    string sql;
                    int ret = 0;
                    DataTable oTable = new DataTable();
                    sql = "GetWithdrawal";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@id" },
                        new DbType[] { DbType.Int32 },
                        new object[] { userId },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                    WithdrawalEntity user = new WithdrawalEntity();
                    if (oTable.Rows.Count > 0)
                    {
                        DataRow oRow = oTable.Rows[0];
                        user = SetData(oRow);

                    }

                    return user;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:35,代码来源:WithdrawalService.cs

示例7: GetInvestors

        public DataTable GetInvestors(int id)
        {
            try
            {

                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {
                    db.Open();
                    string sql;
                    int ret = 0;
                    DataTable oTable = new DataTable();
                    sql = "GetInvestorForDropdown";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@id" },
                        new DbType[] { DbType.Int32 },
                        new object[] { id },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                    return oTable;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:27,代码来源:WithdrawalService.cs

示例8: GetAll

        public DataView GetAll(int loan_id)
        {
            try
            {
                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {

                    db.Open();
                    int ret = 0;
                    DataTable oTable = new DataTable();
                    string sql = "GetPayables";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@loanid" },
                        new DbType[] { DbType.Int32 },
                        new object[] { loan_id },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                    return oTable.DefaultView;

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:27,代码来源:PayableService.cs

示例9: GetAll

        public DataView GetAll(string query)
        {
            try
            {
                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {

                    db.Open();
                    int ret = 0;
                    DataTable oTable = new DataTable();
                    string sql = "GetInvestors";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@query" },
                        new DbType[] { DbType.String },
                        new object[] { query },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                    return FormalFormatTable(oTable).DefaultView;

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:27,代码来源:InvestorService.cs

示例10: SetPassword

        public void SetPassword(int id, string password)
        {
            try
            {
                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {
                    db.Open();
                    string sql;
                    int ret = 0;
                    DataTable oTable = new DataTable();
                    sql = "UpdatePassword";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@password", "@id", "@updatedby" },
                        new DbType[] { DbType.String, DbType.Int32, DbType.String },
                        new object[] { password, id, appUsr.UserName },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:25,代码来源:UserService.cs

示例11: DoesUserExist

        public bool DoesUserExist(string userName, string firstname, string lastname)
        {
            try
            {
                using (Database db = new Database(GlobalObjects.CONNECTION_STRING))
                {
                    db.Open();
                    string sql;
                    int ret = 0;
                    DataTable oTable = new DataTable();
                    sql = "DoesUserExists";
                    db.ExecuteCommandReader(sql,
                        new string[] { "@username", "@firstname", "@lastname" },
                        new DbType[] { DbType.String, DbType.String, DbType.String },
                        new object[] { userName, firstname, lastname },
                        out ret, ref oTable, CommandTypeEnum.StoredProcedure);

                    if (oTable.Rows.Count > 0) { return true; }

                    return false;
                }
            }
            catch (Exception ex) { throw ex; }
        }
开发者ID:jeromefurog,项目名称:moneyloandering,代码行数:24,代码来源:UserService.cs


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