Пример #1
0
        public IList GetDataListBySQL <T>(StringBuilder sql, SqlParam[] param)
        {
            IList list = new List <T>();

            this.dbCommand = this.GetDatabase().GetSqlStringCommand(sql.ToString());
            this.AddInParameter(this.dbCommand, param);
            using (IDataReader dataReader = this.db.ExecuteReader(this.dbCommand))
            {
                list = ReaderToIListHelper.ReaderToList <T>(dataReader);
            }
            return(list);
        }
Пример #2
0
        public IList GetDataListBySQL <T>(StringBuilder sql, SqlParam[] param)
        {
            SQLiteConnection connection = new SQLiteConnection(connectionString);
            SQLiteCommand    cmd        = new SQLiteCommand();

            try
            {
                PrepareCommand(cmd, connection, null, sql.ToString(), param);
                SQLiteDataReader myReader = cmd.ExecuteReader();
                cmd.Parameters.Clear();
                return(ReaderToIListHelper.ReaderToList <T>(myReader));
            }
            catch (System.Data.SQLite.SQLiteException e)
            {
                throw new Exception(e.Message);
            }
        }