-1

I have a the below table script:

"CREATE TABLE " + TABLE_XXX + "("
                    + XXX_ID + " INTEGER PRIMARY KEY,"
                    + XXX_ITEM_NO + "TEXT,"
                    + XXX_DETAILS +"TEXT,"
                    + XXX_EXP_DATE + "TEXT,"
                    + XXX_IS_OK +"INTEGER, "
                    + XXX_CODE + "TEXT"
                    + ")"; 

But when I'm going to insert data getting the error , TABLE_XXX has no column named XXX_IS_OK.

how to overcome it. Thanks!

2
  • 1
    Have you incremented your database version number / cleaned up old database files so that onUpgrade() or onCreate() are called? Commented Sep 10, 2013 at 11:50
  • 1
    there should be space between variable and column constraints like XXX_ITEM_NO + " TEXT,". If no space, then string will be merged, Table will not get created throwing an exception.. Commented Sep 10, 2013 at 11:52

2 Answers 2

1

You need give some spaces on the code. Before the quotation marks.

"CREATE TABLE " + TABLE_XXX + "("   
+ XXX_ID + " INTEGER PRIMARY KEY, "   
+ XXX_ITEM_NO + " TEXT, "     
+ XXX_DETAILS +" TEXT, "   
+ XXX_EXP_DATE + " TEXT, "   
+ XXX_IS_OK + " INTEGER, "
+ XXX_CODE + " TEXT "   
+ ")";  
Sign up to request clarification or add additional context in comments.

Comments

1

There are missing whitespaces in your statement.

+ XXX_IS_OK +"INTEGER, "

should be:

+ XXX_IS_OK +" INTEGER, "

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.