• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps foreign key for sql lite

cowboy

Lurker
Mar 22, 2010
4
0
Hello every one! I have some problem with my SQL request. I am trying to create tables like this :
Code:
 myDB.execSQL("CREATE TABLE IF NOT EXISTS "
    		  + categories
    		  + " (category_id PRIMARY KEY,parent_id INT,FOREIGN KEY(parent_id) REFERENCES categories(category_id),name text,amount float);"); 
      myDB.execSQL("CREATE TABLE IF NOT EXISTS "
    		  + accounts
    		  + " (account_id PRIMARY KEY, name text);");

It is compiled ok. But then i tried to run it on emulator the app has dropped with error :
APPLICATION HAS STOPPED UNEXPECTADLY.

And i ve finded error occur in the FOREIGN KEY. WHAT problem?
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones