Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:08:32+00:00 2026-06-08T17:08:32+00:00

I want to upgrade my database version to 4. I have changed version code

  • 0

I want to upgrade my database version to 4.
I have changed version code in manifest file
and my database openhelper is

@Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        DTLog.w("Old Version" + oldVersion, "new Version" + newVersion);
        DTLog.w("UPDATING DB", "Updating database");

        if (oldVersion == 1 && newVersion == 2) {
            db.execSQL("ALTER TABLE moduleRecord ADD COLUMN subtitle1 TEXT");
            db.execSQL("ALTER TABLE moduleRecord ADD COLUMN subtitle2 TEXT");
            db.delete("moduleRecord", null, null);

        } 
        else if ((oldVersion == 2&&newVersion == 3)) {
            db.execSQL("CREATE TABLE "
                    + "moduleDesc"
                    + "(deleteable INTEGER,createable INTEGER,updateable INTEGER,name TEXT,label TEXT,labelfields TEXT,fields TEXT);");

        } else {
            db.execSQL("DROP TABLE IF EXISTS " + "moduleRecord");
            db.execSQL("DROP TABLE IF EXISTS " + "ModuleName");
            db.execSQL("DROP TABLE IF EXISTS " + "EventStatus");
            db.execSQL("DROP TABLE IF EXISTS " + "moduleDesc");
            onCreate(db);
        }
    }

The error that I get is

     07-31 12:01:15.267: W/System.err(632): 
android.database.sqlite.SQLiteException: no such table: moduleDesc: ,
while compiling: insert into moduleDesc(deleteable,createable,updateable,name,label,labelfields,fields)
values(?,?,?,?,?,?,?)
    07-31 12:01:15.267: W/System.err(632):  
at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
    07-31 12:01:15.267: W/System.err(632): 

at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
    07-31 12:01:15.267: W/System.err(632): 

at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:65)
    07-31 12:01:15.267: W/System.err(632): 

at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:83)

can anyone tell me how to upgrade database

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:08:33+00:00Added an answer on June 8, 2026 at 5:08 pm

    I believe your issue could be the if statement loop that you have. What if the user has either version 1 or version 2 of your application and wants to upgrade to the latest one, which I believe is 4.

    In that case, it will simply fall through the if loop and go to the final else, which tries to drop the table moduleDesc, which only gets created if the user had planned to upgrade from either version 1 or 2 to version 3.

    So in summary, examine your if statements and cater to all conditions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My wamp server is 2.1 version have 5.3.5 php version. I want to upgrade
I want to upgrade the database to a newer version. How would i go
How to upgrade read only sqlite database I have tried to change to SQLiteDatabase.OPEN_READWRITE);
I want to upgrade database schema to a new version. Before I do so,
I want to upgrade my current code which is constantly sql injected with PDO.
I have project I want to upgrade to .Net4 and it use BackgroundCopyManager.dll. Anyone
What is the best option if I want to upgrade old C-code to newer
I have a project made with PhoneGap 1.1. I don't want to upgrade to
I have taken the backup of my live portal and I want to upgrade
A database needs to be upgraded and as part of the upgrade, I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.