Пример #1
0
 /// <summary>
 /// executes command using Parameters
 /// </summary>
 /// <param name="command"></param>
 /// <param name="parms"></param>
 /// <returns>rows affected or -1 for error</returns>
 public override int execute(string command, Parameters parms)
 {
     if (this.connection.State != ConnectionState.Open)
     {
         this.connection.Open();
     }
     int status;
     SQLiteCommand sqliteCommand = new SQLiteCommand(command, this.connection);
     sqliteCommand.Parameters.AddRange(parms.getParameters());
     try
     {
         status = sqliteCommand.ExecuteNonQuery();
     }
     catch
     {
         return -1;
     }
     return status;
 }
Пример #2
0
        /// <summary>
        /// Runs query command given using parameters
        /// </summary>
        /// <param name="command"></param>
        /// <param name="parms"></param>
        /// <returns>results of query</returns>
        public override DbDataReader query(string command, Parameters parms)
        {
            if (this.connection.State == ConnectionState.Closed)
            {
                this.connection.Open();
            }
            SQLiteCommand sqliteCommand = new SQLiteCommand(command, this.connection);
            sqliteCommand.Parameters.AddRange(parms.getParameters());
            SQLiteDataReader results = sqliteCommand.ExecuteReader();

            this.lastQuery = results;

            return results;
        }
Пример #3
0
 /// <summary>
 /// executes command using Parameters
 /// </summary>
 /// <param name="command"></param>
 /// <param name="parms"></param>
 /// <returns>rows affected or -1 for error</returns>
 public abstract int execute(string command, Parameters parms);
Пример #4
0
        /// <summary>
        /// fills a data table using query given
        /// </summary>
        /// <param name="command"></param>
        /// <param name="parms"></param>
        /// <returns>datatable</returns>
        public DataTable fill(string command, Parameters parms)
        {
            if (this.connection.State == ConnectionState.Closed)
            {
                this.connection.Open();
            }

            SQLiteCommand sqliteCommand = new SQLiteCommand(command, this.connection);
            sqliteCommand.Parameters.AddRange(parms.getParameters());
            SQLiteDataAdapter sqliteAd = new SQLiteDataAdapter(sqliteCommand);

            DataTable dt = new DataTable();
            sqliteAd.Fill(dt);

            this.lastQuery = sqliteCommand.ExecuteReader();

            return dt;
        }
Пример #5
0
 /// <summary>
 /// Runs query command given using parameters
 /// </summary>
 /// <param name="command"></param>
 /// <param name="parms"></param>
 /// <returns>results of query</returns>
 public abstract DbDataReader query(string command, Parameters parms);