コード例 #1
0
        /// <summary>
        /// Deletes the records with the given key.
        /// </summary>
        /// <param name="db"></param>
        /// <param name="tableName">Name of the table to remove records from.</param>
        /// <param name="key">Key of the record to delete. Can be anything that can be converted to a property bag.</param>
        /// <returns></returns>
        public static int Delete(this BaDatabase db, string tableName, object key)
        {
            var cmd = db.Connection.CreateCommand();

            PrepareDeleteCmd(cmd, tableName, key);
            return(db.ExecuteNonQuery(cmd));
        }
コード例 #2
0
        /// <summary>
        /// Executes a Transact-SQL statement against the connection and returns the number
        /// of rows affected.
        /// </summary>
        /// <param name="db"></param>
        /// <param name="sprocName">Name of the stored procedure to call.</param>
        /// <param name="parameters">An object that contains the properties to add as SQL parameters to the SQL command.</param>
        /// <returns></returns>
        public static int ExecuteNonQuery(this BaDatabase db, string sprocName, object parameters = null)
        {
            var cmd = db.PrepareSprocCmd(sprocName, parameters);

            return(db.ExecuteNonQuery(cmd));
        }