Hi Android-Berry: Try:
insert into form values(null,11,22,33,44,55,66,77); This would make sure that the _id gets automatically auto-incremented. Hope it helps, Omar Flores. On Mar 28, 10:53 am, Android-Berry <[EMAIL PROTECTED]> wrote: > Hi ALL, > > I open a data base and create table on my database, but when I want > to insert a record, why do I need to > define my table primary key values? > > here is the query to create table: > > CREATE TABLE form ( _id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT > NOT NULL ,addr TEXT NOT NULL ,user TEXT NOT NULL ,pass TEXT NOT > NULL ,definition TEXT NOT NULL ,icon INTEGER NOT NULL ,count > INTEGER NOT NULL ); > > I have defined _id as primary key and auto increment, but when I > insert a record: > > here is the query: > [code] > sqlite> insert into form values(11,22,33,44,55,66,77); > insert into form values(11,22,33,44,55,66,77); > SQL error: table form has 8 columns but 7 values were supplied > > sqlite> insert into form values(11,22,33,44,55,66,77,88); > insert into form values(11,22,33,44,55,66,77,88); > > sqlite> select * from form; > > select * from form; > _id|name|addr|user|pass|definition|icon|count > 11|22|33|44|55|66|77|88 > > sqlite> > [/code] > > Th anks so much~ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

