Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Android Data Persistence Using SQLite for Structured Data Creating a SQLite Table

George Sideris
PLUS
George Sideris
Courses Plus Student 3,712 Points

I create the table also add the TEXT ...

error which i can find where it is ?

AutoSQLiteHelper.java
public class AutoSQLiteHelper extends SQLiteOpenHelper {


  private static final String _TABLE = "CarDb";
  private static final String COMPANY_NAME = "CNAME";
  private static String CREATE_CAR_MAKERS =
    "CREATE TABLE " + _TABLE + "(" +
            "_id INTEGER PRIMARY KEY AUTOINCREMENT," +
            COMPANY_NAME + " TEXT)";

  @Override
  public void onCreate(SQLiteDatabase database) {
    database.execSQL(CREATE_CAR_MAKERS);
  }
}

2 Answers

Seth Kroger
Seth Kroger
56,414 Points

The issue is that you altered the table and column names so they are no longer what the challenge is expecting. "COMPANY_NAME" is supposed to be the name of the column. In other words it needs to be the value of the constant, not necessarily the name of the constant (but it can be both of course).

George Sideris
PLUS
George Sideris
Courses Plus Student 3,712 Points

Thanks for your replay i find the solution . I was thinking more complicated the answer is : public static final String CREATE_CAR_MAKERS = "CREATE TABLE CAR_MAKERS (_id INTEGER PRIMARY KEY AUTOINCREMENT,"+ "COMPANY_NAME TEXT)";