insert data in SQLite

0

I have a BD in SQLite for android and I need to insert 68 articles I could do it this way '

public void onCreate(SQLiteDatabase database) {

        database.execSQL("CREATE TABLE " + DatabaseContents.TABLE_PRODUCT_CATALOG + "("

                + "_id INTEGER PRIMARY KEY,"
                + "name TEXT(100),"
                + "barcode TEXT(100),"
                + "unit_price DOUBLE,"
                + "status TEXT(10),"
                + "numProvider INTEGER,"
                + "productImage TEXT(100)"

                + ");");

        ContentValues cv = new ContentValues();
        cv.put("name", "BONELESS 300 GR BUFFALO FLAMING 1.0 - PIEZA");
        cv.put("barcode", "206802");
        cv.put("unit_price", "15");
        cv.put("status", "ACTIVE");
        cv.put("numProvider", "206802");
        cv.put("productImage", "drawble/boneless");

        int id = (int) database.insert(DatabaseContents.TABLE_PRODUCT_CATALOG.toString(), null, cv);

        Log.d("CREATE DATABASE", "Create " + DatabaseContents.TABLE_PRODUCT_CATALOG + " Successfully.");
    }

but I need a simpler form because it would be a drag to repeat the same process 68 times

    
asked by MIke 16.04.2018 в 22:46
source

0 answers