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

  • SEARCH
  • Home
  • 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 6869643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:35:01+00:00 2026-05-27T03:35:01+00:00

I’m newbie to android. I have gone through the android docs and I googled

  • 0

I’m newbie to android. I have gone through the android docs and I googled it, but I’m confused why my code is returning a no such table error.

I want to create a DB named as demo and I want to create a table student with three columns.

Here’s my code:

    import android.content.ContentValues;
    import android.content.Context;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.database.sqlite.SQLiteDatabase.CursorFactory;
    import android.database.sqlite.SQLiteOpenHelper;



    public class DatabaseHelper extends SQLiteOpenHelper {


        static final String dbName="demo";

    public DatabaseHelper(Context context) {
            super(context, dbName, null, 1);
            // TODO Auto-generated constructor stub
        }



    @Override
    public void onCreate(SQLiteDatabase db) {
        // TODO Auto-generated method stub
        db.execSQL("Create table IF NOT EXISTS  student(title text,address text,gender text)");



    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // TODO Auto-generated method stub

    }

    public void insert_datas(String title,String artist,String patharray,String table_name){
        SQLiteDatabase db=this.getWritableDatabase();

         ContentValues initialValues = new ContentValues();

            initialValues.put("title",title);
            initialValues.put("address",address);
            initialValues.put("gender",gender);

            long n = db.insert(table_name,title,initialValues);

            System.out.println("n"+n);
            db.close();
    }

    public Cursor get_datas(){
        SQLiteDatabase db=this.getReadableDatabase();
           Cursor cur=db.rawQuery("SELECT * FROM student",null);

           return cur;

    }

    }

and this how i m call the DatabaseHelper class:

    public class MYActivity extends Activity{

    DatabaseHelper dbAdapter;
    @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.customlist);
              dbAdapter = new DatabaseHelper(this);

              dbAdapter.insert_datas("test","test","test","student");

    }

}

My error

**11-26 02:10:00.210: INFO/SqliteDatabaseCpp(27151): sqlite returned: error code = 1, msg = no such table: student, db=/data/data/com.player.activites/databases/demo
11-26 02:10:00.210: ERROR/SQLiteDatabase(27151): android.database.sqlite.SQLiteException: no such table: student: , while compiling: INSERT INTO studenty(title,address,gender) VALUES (?,?,?)**

Thanks

  • 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-05-27T03:35:02+00:00Added an answer on May 27, 2026 at 3:35 am

    Try upgrading the database version number (right now you have it as 1). Is it possible you ran your app and tried to access the DB before your helper’s onCreate actually did anything? If you did that, you would have an empty DB at version 1. If you don’t want to increment your version numbers, you could alternatively uninstall your app or clear its data to delete the DB file entirely.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

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.