SQLiteDatabase.ExecuteNonQuery C# (CSharp) Method

ExecuteNonQuery() public method

Allows the programmer to interact with the database for purposes other than a query.
public ExecuteNonQuery ( SQLiteCommand command ) : int
command System.Data.SQLite.SQLiteCommand The SQLCommand to be run.
return int
    public int ExecuteNonQuery(SQLiteCommand command)
    {
        SQLiteConnection cnn = new SQLiteConnection(dbConnection);
        cnn.Open();
        command.Connection = cnn;
        int rowsUpdated = command.ExecuteNonQuery();
        cnn.Close();
        return rowsUpdated;
    }

Same methods

SQLiteDatabase::ExecuteNonQuery ( string sql ) : int

Usage Example

        /**
         * Updates a Slot1 and Slot2 of any GEItem in the database instantly.
         * @param GEItem
         */
        public void updateGEItemSlotsDatabase(GEItem geItem)
        {
            try
            {
                SQLiteDatabase db = new SQLiteDatabase(Constants.databaseName);

                /**
                 * Each time you do in GESession.cs [checkOffer or abortOffer]
                 * A Slot1 and Slot2 is generated but those Slot's themselves are never saved, less data like this.
                 * Only thing thats saved is how much to generate of those Slots next time you call [checkOffer].
                 * Even generated Slots check against how much they can truly take out.
                 */
                if (geItem is BuyOffer)
                {
                    db.ExecuteNonQuery("UPDATE grandExchangeBuying SET collectedItem = " + geItem.getAmountCollectedItem() + ", collectedGold = " + geItem.getAmountCollectedGold() + " WHERE slot = " + geItem.getSlot() + " AND playerHash = " + geItem.getPlayerHash());
                }
                else if (geItem is SellOffer)
                {
                    db.ExecuteNonQuery("UPDATE grandExchangeSelling SET collectedItem = " + geItem.getAmountCollectedItem() + ", collectedGold = " + geItem.getAmountCollectedGold() + " WHERE slot = " + geItem.getSlot() + " AND playerHash = " + geItem.getPlayerHash());
                }

                db.CloseDatabase();
            }
            catch (Exception e)
            {
                misc.WriteError("GrandExchange Error]: " + e.Message);
            }
        }
All Usage Examples Of SQLiteDatabase::ExecuteNonQuery