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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:51:04+00:00 2026-05-31T15:51:04+00:00

I have a problem with my database in Android app. Here’s some code: private

  • 0

I have a problem with my database in Android app. Here’s some code:

private static final String QUESTIONS_TABLE = "questions";
/* questions keys */
public static final String KEY_ROWID = "_id";
public static final String KEY_TYPE = "type";
public static final String KEY_CONTENT = "content";
public static final String KEY_A = "answerA";
public static final String KEY_B = "answerB";
public static final String KEY_C = "answerC";
public static final String KEY_D = "answerD";

private static final String QUESTIONS_TABLE_CREATE = 
    "create table "+ QUESTIONS_TABLE +" (" + KEY_ROWID + " integer primary key autoincrement, "
    + KEY_TYPE + "integer not null,"
    + KEY_CONTENT + " text not null, "
    + KEY_A + " text, "
    + KEY_B + "text, "
    + KEY_C + "text, "
    + KEY_D + "text); ";

//--- QUESTIONS SECTION ---
//--- inserts a close question ---
public long insertCloseQuestion(int type, String content, String[] answers) {
    ContentValues initValues = new ContentValues();
    initValues.put(KEY_TYPE, type);
    initValues.put(KEY_CONTENT, content);
    if(answers != null && answers.length > 0) {
        initValues.put(KEY_A, answers[0]);
        initValues.put(KEY_B, answers[1]);
        initValues.put(KEY_C, answers[2]);
        initValues.put(KEY_D, answers[3]);
    }
    Log.d("VM", initValues.toString());

    return db.insertOrThrow(QUESTIONS_TABLE, null, initValues);
}

When I call insertCloseQuestion method, Android returns an Exception:

android.database.sqlite.SQLiteException: table questions has no column named answerD: , while compiling: INSERT INTO questions(answerD, content, answerB, answerC, type, answerA) VALUES(?, ?, ?, ?, ?, ?);

Do you have any ideas how to fix it? I know there are is a couple of topics like this, but none of the solutions help me.

  • 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-31T15:51:05+00:00Added an answer on May 31, 2026 at 3:51 pm
    private static final String QUESTIONS_TABLE_CREATE = 
        "create table "+ QUESTIONS_TABLE +" (" + KEY_ROWID + " integer primary key autoincrement, "
        + KEY_TYPE + "integer not null,"
        + KEY_CONTENT + " text not null, "
        + KEY_A + " text, "
        + KEY_B + "text, "
        + KEY_C + "text, "
        + KEY_D + "text); ";
    

    I guess there are no spaces between column name and it’s type. KEY_B + "text, " put a space before text (here and with other columns).

    And do not forget to delete database after that (uninstall application from the phone)!

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

Sidebar

Related Questions

I have a problem in php code inserting values into database (I use PHPMyAdmin).
I have android app that talks to server and syncs some data int SQLite
Hello i have problem with my sms aplication. import java.util.ArrayList; import java.util.List; import android.app.Activity;
Hello i have a problem with this aplication. import java.util.ArrayList; import java.util.List; import android.app.Activity;
I am using CakePHP framework with MySQL database and I have problem in saving
I have the following problem in a Database using Access 2007 as front end
i have a problem in inserting the listbox value into mysql database in vb
i have a problem in inserting the listbox value into mysql database in vb
I currently have a problem attepting to update a record within my database. I
I have a problem using the SSIS. I try to import data from database

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.