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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:56:43+00:00 2026-06-17T18:56:43+00:00

My application is unable to create a simple table. Please see the below code,

  • 0

My application is unable to create a simple table. Please see the below code,

DatabaseHandler.java

public class DatabaseHandler extends SQLiteOpenHelper {

private static final int DB_VERSION = 1;
private static final String DB_NAME = "PASSENGER_INFO_DB";
private static final String TABLE_NAME = "PASSENGER_INFO";
private static final String TABLE_COLUMN_SEAT_NO = "SEAT_NO";
private static final String TABLE_COLUMN_NAME = "NAME";
private static final String TABLE_COLUMN_AGE = "AGE";
private static final String TABLE_COLUMN_GENDER = "GENDER";
private static final String TABLE_COLUMN_FOOD_PREF = "FOOD_PREF";

private static final String CREATE_PASSENGER_INFO_TABLE = "CREATE TABLE IF NOT EXISTS "
        + TABLE_NAME + " ( " + TABLE_COLUMN_SEAT_NO
        + " TEXT PRIMARY KEY, " + TABLE_COLUMN_NAME + " TEXT, "
        + TABLE_COLUMN_AGE + " INTEGER, " + TABLE_COLUMN_GENDER
        + " INTEGER, " + TABLE_COLUMN_FOOD_PREF + " TEXT" + ")";

public DatabaseHandler(Context context) {
    super(context, DB_NAME, null, DB_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {
    db.execSQL(CREATE_PASSENGER_INFO_TABLE);
}
public void addPassengerInfo(PassengerInfo passInfo) {
    SQLiteDatabase addPass = this.getWritableDatabase();

    ContentValues values = new ContentValues();

    values.put(TABLE_COLUMN_SEAT_NO, passInfo.getM_seatNo());
    values.put(TABLE_COLUMN_NAME, passInfo.getM_name());
    values.put(TABLE_COLUMN_AGE, passInfo.getM_age());
    values.put(TABLE_COLUMN_GENDER, passInfo.getM_gender());
    values.put(TABLE_COLUMN_FOOD_PREF, passInfo.getM_foodPref());

    addPass.insert(TABLE_NAME, null, values);
    addPass.close();
}

in MainActivity.java

DatabaseHandler dbhandler = new DatabaseHandler(this);
addSeat = "1A";
passName = "NA";
passAge = 0;
passGender = -1;
passFoodPref = "NA";
dbhandler.addPassengerInfo(new PassengerInfo(addSeat, passName, passAge, passGender, passFoodPref));

(PassengerInfo.class has getter and setter methods for the fields)

And when I run this I’m getting the following error in logcat,

01-23 19:09:18.311: I/Database(1303): sqlite returned: error code = 1, msg = table PASSENGER_INFO has no column named SEAT_NO
01-23 19:09:18.370: E/Database(1303): Error inserting FOOD_PREF=NA NAME=NA AGE=0 GENDER=-1 SEAT_NO=1A

I have also checked the tables created in the database through adb shell, there’s no table with name PASSENGER_INFO.
Please help !

  • 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-17T18:56:44+00:00Added an answer on June 17, 2026 at 6:56 pm

    Have you tried increasing your database number? Also, try changing this line

    + TABLE_COLUMN_SEAT_NO
        + " TEXT PRIMARY KEY, "
    

    to

    + TABLE_COLUMN_SEAT_NO
        + " TEXT, "
    

    Add a separate column that will represent the rowId, update your database version number and re-run.

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

Sidebar

Related Questions

I've written a simple Java Console Application in Eclipse that references a WCF web
I am trying to create a simple installer using the wxWizard class. On the
I have created a maven web project using the below site. http://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/ I have
I want to create a simple web based application on Android that loads certain
Im trying to create a simple high/low app but the application crashes when I
I am trying to create a simple android application. I am new to Android
I am attempting to create a simple silverlight 4 application in visual studio 2010
I was trying to create a simple console application to try out Qt's XML
I'm trying to create a simple video application(loading existing video file from ios 4
When I compile my application , I get following compile error. Unable to find

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.