0

I am trying to create two tables, with a key of one table being a key on another table so that I can make one row to many. Here is my oncreate code.

private static final String MESSAGE_TABLE_CREATE =
        "CREATE TABLE " + MESSAGE_HISTORY + " (" +
                MSG_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
                TASK_ID + " INTEGER, " +
                RECEIVER + " TEXT, " +
                SENDER + " TEXT, " +
                CHAT_MSG + " TEXT, " +
                SHOWUTCDATE + " TEXT, " +
                FLAG + " TEXT, " +
                NEWTIMESTAMP + " TEXT, " +
                LAT + " TEXT, " +
                LON + " TEXT, " +
                IMAGE_URL + " TEXT, " +
                DESTINATION + " TEXT, " +
                ATTACHMENT_ID + " TEXT, " +
                MIME + " TEXT, " +
                SIZE + " TEXT, " +
                EXTENSION + " TEXT, " +
                IS_ACCEPTED + " TEXT, " +
                USER_ID + " TEXT " +
                ")";

private static final String VENDOR_TABLE_CREATE =
        "CREATE TABLE " + VENDORS + " (" +
                VENDOR_ID + " INTEGER PRIMARY KEY, " +
                TASK_ID + "INTEGER, " +
                RECEIVER + " TEXT, " +
                SENDER + " TEXT, " +
                VENDOR_NAME + " TEXT, " +
                VENDOR_CONTENT + " TEXT, " +
                VENDOR_STAR + " TEXT, " +
                VENDOR_ADDRESS + " TEXT, " +
                VENDOR_COMMENTS + " TEXT, " +
                VENDOR_DISTANCE + " TEXT, " +
                MOBILE + " TEXT, " +
                PHONE + " TEXT, " +
                LAT + " TEXT, " +
                LON + " TEXT, " +
                JUDESAYS + " TEXT " +
                ")";


public TasksDBOpenHelper (Context context){
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db){
    db.execSQL(CURRENT_TABLE_CREATE);
    db.execSQL(HISTORY_TABLE_CREATE);
    db.execSQL(MESSAGE_TABLE_CREATE);
    db.execSQL(VENDOR_TABLE_CREATE);
}

For some reason, on the vendors table the column "TASK_ID" is not being created.

1 Answer 1

1

You're missing a space between TASK_ID & the word INTEGER.

Should be TASK_ID + " INTEGER, " +

Sign up to request clarification or add additional context in comments.

Comments

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.