> 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. After changing code as I understand what
you are saying

sampleDB.execSQL("CREATE TABLE IF NOT EXISTS " +
                                        SWITCH_TABLE_NAME +
                        " (SwitchID integer  ,SwitchName
VARCHAR,FOREIGN KEY (SwitchID)REFERENCES roomtable (RoomID));");

                        sampleDB.execSQL("INSERT INTO " +
                                        SWITCH_TABLE_NAME +
                                        " Values ('"+s1+"');");


But now it gives me error as
11-13 15:08:21.024: ERROR/Database(773): Failure 1 (table switchtable
has 2 columns but 1 values were supplied) on 0x2f95d0 when preparing
'INSERT INTO switchtable Values ('Tube Light');'.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to