Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="TextQuery"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool ExecuteWithRead(string TextQuery, out DataTable result)
        {
            result = new DataTable();
            if (!ExecuteQuery(QueryParser(TextQuery)))
            {
                return(false);
            }
            for (int i = 0; i < MyReader.FieldCount; i++)
            {
                result.Columns.Add(MyReader.GetName(i), MyReader.GetFieldType(i));
            }

            while (MyReader.Read())
            {
                DataRow dr = result.NewRow();
                for (int col = 0; col < MyReader.FieldCount; col++)
                {
                    dr[col] = MyReader.GetValue(col);
                }
                result.Rows.Add(dr);
            }
            MyReader.Close();

            return(true);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="TextQuery"></param>
        /// <param name="result"></param>
        public void ExecuteWithReadNew(string TextQuery, out DataTable result)
        {
            result = new DataTable();
            if (!ExecuteQuery(QueryParser(TextQuery)))
            {
                throw new TransportExcception(ExcStr);
            }
            for (int i = 0; i < MyReader.FieldCount; i++)
            {
                result.Columns.Add(MyReader.GetName(i), MyReader.GetFieldType(i));
            }

            while (MyReader.Read())
            {
                DataRow dr = result.NewRow();
                for (int col = 0; col < MyReader.FieldCount; col++)
                {
                    dr[col] = MyReader.GetValue(col);
                }
                result.Rows.Add(dr);
            }
            MyReader.Close();
        } // Обратная совместимость