android - Need Help For Foreign Key -


        db.execsql(" create table " + kk_airlinebook + " (" + key_id                 + " integer primary key autoincrement, " + key_srno + " integer, " + key_bname + " text , "                       + key_bookingdate                 + " text, " + key_pickupaddress + " text, " + key_city                 + " text, " + key_airporttype + " text, "+ key_trip + " text, " + key_cabr + " text , "                 + key_flightdate + " text, " + key_flighttime + " text, " + key_cabdate                 + " text, " + key_pickuptime + " text, " + key_totalseats                 + " integer, " + key_charges + " integer , "                 +  "foreign key ," + key_srno + " references  kk_registration , " + key_id +");"); 

log cat:

05-04 20:06:36.034: e/sqlitelog(26155): (1) near ",": syntax error 05-04 20:06:36.364: e/androidruntime(26155): fatal exception: main 05-04 20:06:36.364: e/androidruntime(26155): java.lang.runtimeexception: unable start activity componentinfo{com.raintek.customerhome/com.raintek.customerhome.login}: android.database.sqlite.sqliteexception: near ",": syntax error (code 1): , while compiling: create table airline (id integer primary key autoincrement, srno integer, bname text , bookingdate text, pickupaddress text, city text, airporttype text, trip text, cab text , flightdate text, flighttime text, cabdate text, pickuptime text, totalseats integer, charges integer , foreign key ,srno references  kk_registration , id); 05-04 20:06:36.364: e/androidruntime(26155):    @ dalvik.system.nativestart.main(native method) 05-04 20:06:36.364: e/androidruntime(26155): caused by: android.database.sqlite.sqliteexception: near ",": syntax error (code 1): , while compiling: create table airline (id integer primary key autoincrement, srno integer, bname text , bookingdate text, pickupaddress text, city text, airporttype text, trip text, cab text , flightdate text, flighttime text, cabdate text, pickuptime text, totalseats integer, charges integer , foreign key ,srno references  kk_registration , id); 

how use foreign key in android sqlite code shows syntax error near "foreign key" wrong in above code please me thank you

the format foreign key follows:

foreign key(srno) references kk_registration(id) 

you have commas.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

How to call a javascript function after the page loads with a chrome extension? -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -