I am always getting this error.I think query is allright.What is problem?
"Caused by: android.database.sqlite.SQLiteException: near "to": syntax error: , while compiling: create table Messages(_id integer , msgdesc text ,date timestamp not null, createdby integer not null, to integer not null); "
This is my code:
public class ContactListDB extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 2;
private static final String DATABASE_NAME = "MobileMerch";
// Database creation SQL statement
private static final String CREATE_MERCH = "create table Merchendiser" +
"(_id integer primary key, name text not null,surname text not null,username text not null);";
// Database creation SQL statement
private static final String CREATE_MESSAGES = "create table Messages" +
"(_id integer , msgdesc text ,date timestamp not null, createdby integer not null, to integer not null);";
public ContactListDB(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_MERCH);
db.execSQL(CREATE_MESSAGES);
}