Reputation: 115
I'm developing a database for my app and when I try to add a new user into the database I get this error
android.database.sqlite.SQLiteException: near "CREATE": syntax error while
I've looked at other questions and seen that the spacing and quote positioning is very important. But looking at other working examples mine's seems to be correct?
My class below
private static final String TABLE_NAME = "FITNESSMATETABLE";
private static final String DATABASE_NAME = "fitnessmatedatabase";
private static final String USERID = "_id";
private static final String NAME = "Name";
private static final String PASSWORD = "Password";
//Database Version
private static final int DATABASE_VERSION = 18;
//The database strings themselves
private static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME
+ " (" + USERID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + NAME
+ " TEXT, " + PASSWORD + " TEXT);";
Looking at the error I believe it's telling me that the quotations around "CREATE" are wrong. Can anyone see anything out of the ordinary?
Thanks in advance
Upvotes: 0
Views: 534
Reputation: 2878
The following syntax will work for you
create table FITNESSMATETABLE (_id integer primarykey auto increment,Name text,password text);
Upvotes: -1
Reputation: 2295
Varcars aren't available in sqlite. Trying replacing them with TEXT. Check here for sqlite data types http://www.sqlite.org/datatype3.html
Upvotes: 2