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 8300603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:37:33+00:00 2026-06-08T16:37:33+00:00

I am getting a table not found error. I googled a lot but not

  • 0

I am getting a table not found error. I googled a lot but not able to found the source of the error

public class update extends Activity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.update);
        Button upbtn=(Button)findViewById(R.id.upbutton);
        final EditText detedit=(EditText)findViewById(R.id.upedit);
        final EditText amtedit=(EditText)findViewById(R.id.editText1);
        stdb obj=new stdb(this);
        final SQLiteDatabase dobj=obj.getWritableDatabase();
        upbtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            String setdet,setamt;
            setdet=detedit.getText().toString();
            setamt=amtedit.getText().toString();
            //try{

            String insertQuery = "INSERT INTO " +stdb.tname+" (" + stdb.details+" , "+stdb.amt+") VALUES("+setdet+" , "+setamt+");";

            //Log.e("sql",insertQuery);

            dobj.execSQL(insertQuery);
            //}
            //catch(SQLException e ){
            //  Log.e("sqlite",e.toString());

            //}

        }
    });


    }

}

SQLiteOpenHelper:

public class stdb extends SQLiteOpenHelper {

    private static final int version = 1;
    public static final String dname = "statments.db";
    public static final String tname="transactions";
    public static final String sid = "sno";
    public static final String details = "details";
    public static final String amt = "amount";

    public stdb(Context context) {
        super(context, dname, null, version);
        // TODO Auto-generated constructor stub
    }


    @Override
    public void onCreate(SQLiteDatabase db) {
        // TODO Auto-generated method stub

        String ex="CREATE TABLE " + tname + " (" + sid + " INTEGER PRIMARY KEY AUTOINCREMENT," + details+ " VARCHAR(255),"+amt+" INTEGER);";
        Log.e("ex",ex );

        db.execSQL("CREATE TABLE " + tname + " (" + sid + " INTEGER PRIMARY KEY AUTOINCREMENT," + details+ " VARCHAR(255),"+amt+" INTEGER);");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        db.execSQL("DROP TABLE IF EXISTS "+ tname);
        onCreate(db);
    }

}
  • 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-08T16:37:34+00:00Added an answer on June 8, 2026 at 4:37 pm

    Try incrementing the version number:

    private static final int version = 2;
    

    I’m guessing that you changed your CREATE TABLE statement at some point, but the system won’t know about these changes automatically. The easiest way to update your schema is to add 1 to version.

    Also

    You shouldn’t use execSQL() for INSERT commands, use insert():

    ContentValues initialValues = new ContentValues();
    initialValues.put(stbd.details, setdet);
    initialValues.put(stbd.amt, setamt);
    dobj.insert(stbd.tname, null, initialValues);
    

    Or rawQuery():

    String insertQuery = "INSERT INTO " +stdb.tname+" (" + stdb.details+" , "+stdb.amt+") VALUES(?, ?);";
    dobj.rawQuery(insertQuery, new String[] {setdet, setamt});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting this error when I run db:migrate Mysql2::Error: Table 'sample_app_development.microposts' doesn't exist:
Getting an error with my code found HERE ... Which is a culmination of
I am getting following runtime error. anyfile.cpp (60) : E_FATAL : Could not start
UPDATE: Found the error to be related to the path. A literal path fixed
Error Message: Row not found or changed. Stack Trace: at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) at System.Data.Linq.DataContext.SubmitChanges(ConflictMode
I am getting 406 Not Acceptable error when submitting my form with jQuery. I
I'm having trouble getting my table to behave. The content keeps overflowing and my
I am designed a dynamic table for getting input from user. Each column of
I'am trying to insert record into db2 table and getting a result with response.write.
One of my database fields in a table is getting modified by some piece

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.