1
        public void onCreate(SQLiteDatabase db) {
            String query = "CREATE TABLE " + TABLE_INFO + "(" +
            COLUMN_ID + " INTEGER PRIMARY KEY " +
            COLUMN_DATE + " TEXT " +
            COLUMN_DOCNAME + " TEXT " +
            COLUMN_SYMP + " TEXT " +
            COLUMN_DIGNO + " TEXT " +
            COLUMN_MEDS + " TEXT " +
            ");";
     db.execSQL(query);

What is wrong with this? Getting the AndroidRuntime:

FATAL EXCEPTION: main android.database.sqlite.SQLiteException:                                  
                 near "date": syntax error: ,
 while compiling: CREATE TABLE info(_id INTEGER PRIMARY KEY 
                   date TEXT 
                   docName TEXT symp TEXT digno TEXT meds TEXT );

Error.

Please help

1
  • 1
    comma , missing after every column datatype Commented Jan 16, 2016 at 6:29

2 Answers 2

1

You have comma missing in the query after each column, change the query string as below:

String query = "CREATE TABLE " + TABLE_INFO + "(" +
        COLUMN_ID + " INTEGER PRIMARY KEY, " +
        COLUMN_DATE + " TEXT, " +
        COLUMN_DOCNAME + " TEXT, " +
        COLUMN_SYMP + " TEXT, " +
        COLUMN_DIGNO + " TEXT, " +
        COLUMN_MEDS + " TEXT " +
        ");";
Sign up to request clarification or add additional context in comments.

Comments

0

You are missing comma . Add it .

1 Comment

thanks, later on i figured out my stupid mistake, thanks again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.