[C#]分享一个以前的项目使用的DataBaseAccess类(9)

try
            {
                debug("Execute SQL Command:" + sqlcmd.CommandText);
                this.conn.Open();
                if (iStartRecord < 0) iStartRecord = 0;
                sqlda.Fill(dsReapter, iStartRecord, iMaxRecord, strTableName);
                return dsReapter;
            }
            catch (SqlException ex)
            {
                debug("Exception information:" + ex.ToString());
                throw ex;
            }
            finally
            {
                sqlcmd.Dispose();
                sqlda.Dispose();
                this.conn.Close();
            }
        }

/// <summary>
        /// Define pagination(Execute SQL Command,return DataSet).
        /// </summary>
        /// <param>SQL Command which will be Executed</param>
        /// <param>index of StartRecord</param>
        /// <param>number of Records</param>
        /// <param>table name</param>
        /// <returns>return DataSet.</returns>
        public DataSet ExecuteSqlDsEx(string strSql, int iStartRecord, int iMaxRecord, string strTableName)
        {
            debug("Now Execute DataBaseAccess's Method:ExecuteSqlDsEx(string,int,int,string),Return Type:DataSet ");
            return ExecuteSqlDsEx(new SqlCommand(strSql), iStartRecord, iMaxRecord, strTableName);
        }

/// <summary>
        /// Define pagination(Execute SQL Command,return DataSet).
        /// </summary>
        /// <param>SQL Command which will be Executed</param>
        /// <param>SQL Parameters Collection</param>
        /// <param>index of StartRecord</param>
        /// <param>number of Records</param>
        /// <param>table name</param>
        /// <returns>return DataSet.</returns>
        public DataSet ExecuteSqlDsEx(string strSql, SqlParameter[] sqlParameters, int iStartRecord, int iMaxRecord, string strTableName)
        {
            debug("Now Execute DataBaseAccess's Method:ExecuteSqlDsEx(string, SqlParameter[], int, int, string),Return Type:DataSet ");
            return ExecuteSqlDsEx(SQLHelper.CreateCommand(strSql, sqlParameters, this.conn), iStartRecord, iMaxRecord, strTableName);
        }

#endregion

#region ExecuteSqlDr

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyjwyj.html