android sqlite foreign key,SQlite - Android - Foreign key syntax

I've been trying to get foreign keys working within my Android SQLite database. I have tried the following syntax but it gives me a force close:

private static final String TASK_TABLE_CREATE = "create table "

+ TASK_TABLE + " (" + TASK_ID

+ " integer primary key autoincrement, " + TASK_TITLE

+ " text not null, " + TASK_NOTES + " text not null, "

+ TASK_DATE_TIME + " text not null, FOREIGN KEY ("+TASK_CAT+") REFERENCES "+CAT_TABLE+" ("+CAT_ID+"));";

Any ideas what I might be doing wrong? if you need to see the other table structure then I can, its just a very simple structure for the second with an ID and a name.

Edit:

Here is the error:

03-13 13:42:35.389:

ERROR/AndroidRuntime(312): Caused by:

android.database.sqlite.SQLiteException:

unknown column "taskCat" in foreign

key definition: create table reminders

(_id integer primary key

autoincrement, task_title text not

null, notes text not null,

reminder_date_time text not null,

FOREIGN KEY (taskCat) REFERENCES

category (_id));

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值