Note that there are some explanatory texts on larger screens.

plurals
  1. POFailure 1 (near "NULLenergy_rates": syntax error) on 0x2d7a30
    text
    copied!<p>I'm creating an Database for my Application that I am creating however whenever I run my application and try to enter some information into my database nothing happens and an error message is displayed in the LogCat. The full error message is:</p> <p>"04-09 17:22:18.208: E/Database(484): Failure 1 (near "NULLenergy_rates": syntax error) on 0x2d7a30 when preparing 'CREATE TABLE ApplianceDetails (_id INTEGER PRIMARY KEY, appliance_name TEXT NOT NULL, appliance_wattage TEXT NOT NULLenergy_rates TEXT NOT NULL);'.</p> <p>It is associated with this code:</p> <pre><code>public class Database { public static final String KEY_ROWID = "_id"; public static final String KEY_NAME = "appliance_name"; public static final String KEY_WATTAGE = "appliance_wattage"; public static final String KEY_ENERGY = "energy_rates"; private static final String DATABASE_NAME = "TheApplianceKeeperdb"; private static final String DATABASE_TABLE = "ApplianceDetails"; private static final int DATABASE_VERSION = 1; private DbHelper ourHelper; private final Context ourContext; private SQLiteDatabase ourDatabase; private static class DbHelper extends SQLiteOpenHelper{ public DbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" + KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_NAME + " TEXT NOT NULL, " + KEY_WATTAGE + " TEXT NOT NULL" + KEY_ENERGY + " TEXT NOT NULL);" ); } </code></pre> <p>any help on how I can fix this error would be greatly appreciated</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload