示例#1
0
        /// <summary>
        /// 执行查询语句,返回MySqlDataReader ( 注意:调用该方法后,一定要对MySqlDataReader进行Close )
        /// 因为外部要读取数据,不能立即回收连接,所以以MyDataReader封装一下关闭回收连接的操作
        /// </summary>
        /// <param name="strSQL">查询语句</param>
        /// <returns>MySqlDataReader</returns>
        public static MyDataReader ExecuteReader(string dbKey, string strSQL)
        {
            MyDbConnection2 conn = null;

            conn = PopDBConnection(dbKey);
            if (null != conn)
            {
                MySqlDataReader mySqlDataReader = conn.ExecuteReader(strSQL);
                MyDataReader    myDataReader    = new MyDataReader(conn, mySqlDataReader);
                return(myDataReader);
            }

            return(null);
        }
示例#2
0
        public static MyDataReader ExecuteReader(string dbKey, string strSQL)
        {
            MyDbConnection2 conn = DbHelperMySQL3.PopDBConnection(dbKey);
            MyDataReader    result;

            if (null != conn)
            {
                MySqlDataReader mySqlDataReader = conn.ExecuteReader(strSQL, new MySqlParameter[0]);
                MyDataReader    myDataReader    = new MyDataReader(conn, mySqlDataReader);
                result = myDataReader;
            }
            else
            {
                result = null;
            }
            return(result);
        }
示例#3
0
        /// <summary>
        /// 执行查询语句,返回MySqlDataReader ( 注意:调用该方法后,一定要对MySqlDataReader进行Close )
        /// </summary>
        /// <param name="strSQL">查询语句</param>
        /// <returns>MySqlDataReader</returns>
        public static MySqlDataReader ExecuteReader(string dbKey, string SQLString, params MySqlParameter[] cmdParms)
        {
            MyDbConnection2 conn = null;

            try
            {
                conn = PopDBConnection(dbKey);
                if (null == conn)
                {
                    return(null);
                }

                return(conn.ExecuteReader(SQLString, cmdParms));
            }
            finally
            {
                PushDBConnection(conn);
            }
        }
示例#4
0
        public static MySqlDataReader ExecuteReader(string dbKey, string SQLString, params MySqlParameter[] cmdParms)
        {
            MyDbConnection2 conn = null;
            MySqlDataReader result;

            try
            {
                conn = DbHelperMySQL3.PopDBConnection(dbKey);
                if (null == conn)
                {
                    result = null;
                }
                else
                {
                    result = conn.ExecuteReader(SQLString, cmdParms);
                }
            }
            finally
            {
                DbHelperMySQL3.PushDBConnection(conn);
            }
            return(result);
        }