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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:49:10+00:00 2026-05-23T17:49:10+00:00

This is a very basic question. I am just trying to understand how SQLite

  • 0

This is a very basic question. I am just trying to understand how SQLite database works. So, here’s what I do: In the code section below which is taken from notepad tutorial 3rd exercise, I change KEY_TITLE to KEY_NAME and all place I find title to name. And the application crashes. Why does this happen?

public static final String KEY_TITLE = "title";
//change to:     public static final String KEY_NAME = "name";
public static final String KEY_BODY = "body";
public static final String KEY_ROWID = "_id";

private static final String TAG = "NotesDbAdapter";
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;

/**
 * Database creation sql statement
 */
private static final String DATABASE_CREATE =
    "create table notes (_id integer primary key autoincrement, "
    + "title text not null, body text not null);";

/*change to:
private static final String DATABASE_CREATE =
“create table notes (_id integer primary key autoincrement, ”
+ “name text not null, body text not null);”;
*/

  • 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-23T17:49:11+00:00Added an answer on May 23, 2026 at 5:49 pm

    It would be helpful if you copied the stack trace (using logcat / DDMS) or copied your entire SQLiteDBAdapter, but just looking at what you posted, you definitely have a problem in that you’re using the wrong field name in the sqlite database create statement.

    The “title” field should be renamed “name” to match your changed column name.

    Change:

    private static final String DATABASE_CREATE =
    "create table notes (_id integer primary key autoincrement, "
    + "title text not null, body text not null);";
    

    To

    private static final String DATABASE_CREATE =
    "create table notes (_id integer primary key autoincrement, "
    + "name text not null, body text not null);";
    

    I also tend to just use the statics themselves in the create statement, so it could be written like the following:

        private static final String DATABASE_CREATE =
    "create table notes (" + KEY_ROWID + " integer primary key autoincrement, "
    + KEY_NAME + " text not null, " + KEY_BODY + " text not null);";
    

    Then you could change the names often and not encounter database create breakage.

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

Sidebar

Related Questions

This is a very basic question. I'm just on my mission to learn ASP.NET
I realise that this is a very basic question, but it is one which
I'm trying a very basic XPath on this xml (same as below), and it
I know this maybe a very basic question but I'm having a bit of
Now I must be missing something here, as this seems a very basic issue
I realize that this is probably a very basic question, but I have spent
Apologies for the very basic question! I just want to read in a latex
This very simple code gives me tons of errors: #include <iostream> #include <string> int
I'm sorry for this very newbish question, I'm not much given into web development.
I'm quite ashemed to ask this question here because I'm sure that I'm missing

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.