how are you ?
im trying to make a sqlite data base there is my code `
<i>`public class SQliteHelper extends SQLiteOpenHelper {
public static final int DATABASE_VERSION = 1;
public static final String DATABASE_NAME = "moneyDB";
public static final String TABLE_MONEY = "money", KEY_DATE = "date", KEY_VALUE = "value", KEY_WHY = "why";
public static final String[] COLUMNS = {KEY_DATE,KEY_VALUE, KEY_WHY};
public SQliteHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_MONEY_TABLE = "CREATE TABLE" + TABLE_MONEY + "("
+ KEY_DATE +"TEXT PRIMARY KEY," +
KEY_VALUE + "TEXT," +
KEY_WHY +"TEXT, )";
db.execSQL(CREATE_MONEY_TABLE);
}
<i>
and this is my add method
<i>public void addDate(money money) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(KEY_DATE, money.getDate());
contentValues.put(KEY_VALUE, money.getMoney());
contentValues.put(KEY_WHY, money.getWhy());
db.insert(TABLE_MONEY,null,contentValues);
db.close();
}<i>
every time i run the app i get an error "02-15 21:02:22.242 27324-27324/com.main.project.money E/SQLiteLog﹕ (1) table money has no column named date 02-15 21:02:22.252 27324-27324/com.main.project.money E/SQLiteDatabase﹕ Error inserting date=15/02/2015 why=gg value=55 android.database.sqlite.SQLiteException: table money has no column named date (code 1): , while compiling: INSERT INTO money(date,why,value) VALUES (?,?,?) "
Help me if you can please .
Aucun commentaire:
Enregistrer un commentaire