[android-developers] Re: Auto increment foreign key

2010-11-13 Thread pramod.deore
Hi, Bibek But when I write a command for foreign key then it doesn't give me any error. And I didn't find any doc which say that foreign key is not supported in android database. But when i add autoincrement for foreign key then it gives me error. My query is sampleDB.execSQL(CREATE TABLE IF

Re: [android-developers] Re: Auto increment foreign key

2010-11-13 Thread Kostya Vasilyev
You don't need 'autoincrement', I think it's for MS SQL Server. Just don't specify a value for the primary key when inserting, and a new unique value will be generated for you. It is then returned by insert() to your code, so you can use it in the 'many' table. -- Kostya Vasilyev --

[android-developers] Re: Auto increment foreign key

2010-11-13 Thread pramod.deore
You don't need 'autoincrement', I think it's for MS SQL Server. Just don't specify a value for the primary key when inserting, and a new unique value will be generated for you. It is then returned by insert() to your code, so you can use it in the 'many' table. Actually I didn't get you.

Re: [android-developers] Re: Auto increment foreign key

2010-11-13 Thread Kostya Vasilyev
Pramod, You do need autoincrement - but it you also need to mark the column as the primary key. Sorry about the confusion: CREATE TABLE room ( _id INTEGER PRIMARY KEY AUTOINCREMENT room_name TEXT ) CREATE TABLE equipment_in_room ( _id INTEGER