hi i am trying to make a raffle table but however i did created the database but no table is create, the run panel shows that i created it but the sqlite browser shows that there is nothing in it. here is the code: in the database java:
public void onCreate(SQLiteDatabase db)
{
// Note the use of super, which calls the constructor of the SQLiteOpenHelper class,
// which does the actual work of opening the database.
Log.d(TAG, "DatabaseHelper onCreate");
Log.d(TAG, RaffleTable.CREATE_STATEMENT);
db.execSQL(RaffleTable.CREATE_STATEMENT);
}
in the raffletalbe.java:
public class RaffleTable {
public static final String TABLE_NAME = "Raffle";
public static final String KEY_ID = "raffle_id";
public static final String KEY_NAME = "raffle_name";
public static final String KEY_PRICE = "price";
public static final String KEY_START = "raffle_start";
public static final String KEY_END = "raffle_end";
public static final String KEY_DESCRIPTION = "raffle_description";
public static final String KEY_TYPE = "raffle_type";
public static final String KEY_PRIZE = "raffle_prize";
public static final String KEY_LIMIT = "raffle_limit";
public static final String CREATE_STATEMENT = "CREATE TABLE "
+ TABLE_NAME
+ " (" + KEY_ID + " integer primary key autoincrement, "
+ KEY_NAME + " string not null, "
+ KEY_DESCRIPTION + " string, "
+ KEY_START + " string not null, "
+ KEY_END + " string not null, "
+ KEY_TYPE + " integer not null, "
+ KEY_LIMIT + " integer, "
+ KEY_PRIZE + " String, "
+ KEY_PRICE + " real);";
what it shows in the run panel:
D/RaffleDatabase: DatabaseHelper onCreate
CREATE TABLE Raffle (raffle_id integer primary key autoincrement, raffle_name string not null, raffle_description string, raffle_start string not null, raffle_end string not null, raffle_type integer not null, raffle_limit integer, raffle_prize String, price real);
here is the code i used to insert the table:
Raffle Ruffle1 = new Raffle();
Ruffle1.setRuffleDes("742 Evergreen Terrace");
Ruffle1.setRuffleEnd("20190102");
Ruffle1.setRuffleStart("20190101");
Ruffle1.setRuffleLimit(5);
Ruffle1.setRuffleName("testing");
Ruffle1.setRufflePrize("cooper");
Ruffle1.setRuffleType("Normal");
Ruffle1.setRufflePrice(1000);
Raffle Ruffle2 = new Raffle();
Ruffle2.setRuffleDes("742 Evergreen Terrace");
Ruffle2.setRuffleEnd("20190102");
Ruffle2.setRuffleStart("20190101");
Ruffle2.setRuffleLimit(5);
Ruffle2.setRuffleName("testing");
Ruffle2.setRufflePrize("cooper");
Ruffle2.setRuffleType("Normal");
Ruffle2.setRufflePrice(1000);
RaffleTable.insert(db, Ruffle1);
RaffleTable.insert(db, Ruffle2);