Пример #1
0
        /// <summary>
        /// Execute the SQL statement returns the result to the DataSet
        /// </summary>
        /// <param Name="strSQL"> </ param>
        /// <returns> DataSet </ returns>

        public DataSet ReturnDataSet(string strSQL)
        {
            DataSet _DataSet = null;

            try
            {
                _TrackerDbConn.Open();
                _DataSet = new DataSet();
                OleDbDataAdapter _OleDbDA = new OleDbDataAdapter(strSQL, _TrackerDbConn);
                _OleDbDA.Fill(_DataSet, "objDataSet");
            }
            catch (OleDbException _ex)
            {
                // Handle exception.
                TrackerTools _Tools = new TrackerTools();
                _Tools.SetTrackerSessionErrorString(_ex.Message);
                _DataSet.Dispose();
                throw;
            }
            finally
            {
                _TrackerDbConn.Close();
            }

            return(_DataSet);
        }
Пример #2
0
        public OleDbDataReader ReturnDataReader(string strSQL)
        {
            OleDbDataReader _OleDataReader = null;

            try
            {
                _TrackerDbConn.Open();
                OleDbCommand _cmd = new OleDbCommand(strSQL, TrackerDbConn);
                _OleDataReader = _cmd.ExecuteReader();
            }
            catch (OleDbException _ex)
            {
                // Handle exception.
                TrackerTools _Tools = new TrackerTools();
                _Tools.SetTrackerSessionErrorString(_ex.Message);
                _OleDataReader.Dispose();
            }
            finally
            {
                ///
            }
            return(_OleDataReader);
        }