Bonsoir à tous ,
Je développe une application android avec une base de données , cependant j'ai une erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
 android.database.sqlite.SQLiteException: no such column: datecreation (code 1): , while compiling: SELECT _id, titre, description, importance, datealarme, datecreation FROM Notes
Pourtant j'ai bien mis cette colonne lors de la création de ma table , voici mon datableHandler :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.hascoet.ubo_blocnote.database;
 
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
 
public class DatabaseHandler extends SQLiteOpenHelper {
	// nom de la base de donnée
	public static final String BASE_NAME = "notes.db";
	// Version de la base de donnée
	public static final int VERSION_BASE = 1;
 
	public static final String NOTE_KEY = "_id";
	public static final String NOTE_TITRE = "titre";
	public static final String NOTE_DESCRIPTION = "description";
	public static final String NOTE_IMPORTANCE = "importance";
    public static final String NOTE_DATE = "datealarme";
    public static final String NOTE_CREATION = "datecreation";
	public static final String NOTE_TABLE_NAME = "Notes";
 
	// Creation de la table
	public static final String NOTE_TABLE_CREATE =
			"CREATE TABLE " + NOTE_TABLE_NAME + " (" +
					NOTE_KEY + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
					NOTE_TITRE + " TEXT NOT NULL, " +
                    NOTE_DESCRIPTION + " TEXT NOT NULL, "+
					NOTE_IMPORTANCE + " INTEGER NOT NULL, "+
                    NOTE_CREATION + "TEXT NOT NULL, "+
                    NOTE_DATE + " TEXT);";
 
 
	// Supression de la table
	public static final String NOTE_TABLE_DROP = "DROP TABLE IF EXISTS " + NOTE_TABLE_NAME + ";";
 
 
	public DatabaseHandler(Context context)
	{
		super(context,BASE_NAME,null,VERSION_BASE);
	}
 
	public DatabaseHandler(Context context, String name, CursorFactory factory, int version) {
		super(context, name, factory, version);
	}
 
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(NOTE_TABLE_CREATE);
	}
 
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL(NOTE_TABLE_DROP);
		onCreate(db);
 
	}
}
Et la classe de gestion de la base de données :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
package com.hascoet.ubo_blocnote.database;
 
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
 
import com.hascoet.ubo_blocnote.Note;
 
import java.util.ArrayList;
import java.util.List;
 
public class NotesDB {
 
	// Database fields
	private SQLiteDatabase database;
	private DatabaseHandler dbHandler;
	private String[] allColumns = { DatabaseHandler.NOTE_KEY,DatabaseHandler.NOTE_TITRE,
			DatabaseHandler.NOTE_DESCRIPTION,DatabaseHandler.NOTE_IMPORTANCE,DatabaseHandler.NOTE_CREATION,DatabaseHandler.NOTE_DATE};
 
 
	// Champs SQL
	public static final String KEY = "_id";
	public static final String TITRE = "titre";
	public static final String DESCRIPTION = "description";
	public static final String IMPORTANCE = "importance";
    public static final String DATE = "datealarme";
    public static final String CREATION = "datecreation";
	public static final String TABLE_NAME = "Notes";
 
 
	public NotesDB(Context context)
	{
		dbHandler = new DatabaseHandler(context);
	}
 
	public void open() throws SQLException
	{
		database = dbHandler.getWritableDatabase();
	}
 
	public void close()
	{
		dbHandler.close();
	}
 
	/**
         * Ajoute une note dans la base de données
         * @param n la note à ajouter à la base
         */
	public void ajouter(Note n) {
		ContentValues value = new ContentValues();
		value.put(NotesDB.TITRE, n.getTitre().trim());
		value.put(NotesDB.DESCRIPTION, n.getDescription().trim());
		value.put(NotesDB.IMPORTANCE,n.getImportance());
        value.put(NotesDB.CREATION,n.getDateCreationString());
        value.put(NotesDB.DATE,n.getDateString());
		database.insert(NotesDB.TABLE_NAME, null, value);
 
	}
 
	/**
         * supprimer une note avec son ID
         * @param id l'identifiant de la note à supprimer
         */
	public int supprimer(int id) {
		int retour = database.delete(TABLE_NAME, KEY + " = ?",new String[]{String.valueOf(id)});
		return retour;
	}
	/**
         * supprimer une note avec son titre
         * @param note a supprimer
         */
	public int supprimer(Note note)
	{
		int retour = database.delete(TABLE_NAME, TITRE + " = ?",new String[]{note.getTitre().trim()});
		return retour;
	}
 
	/**
         *  modifier une note
         * @param n la note à modifier
         */
	public void modifier(Note n) {
        ContentValues value = new ContentValues();
        value.put(NotesDB.TITRE, n.getTitre().trim());
        value.put(NotesDB.DESCRIPTION, n.getDescription().trim());
        value.put(NotesDB.IMPORTANCE,n.getImportance());
        value.put(NotesDB.DATE,n.getDateString());
        database.update(NotesDB.TABLE_NAME,value,"_id"+"="+n.getId(),null);
     }
 
	/**
         *      Selectionne une note avec son ID
         * @param id l'identifiant de la note à récupérer
         */
	public Note selectionner(int id) {
		Cursor c = database.rawQuery("SELECT * from " + TABLE_NAME +
				" where " + KEY + " = ? ;" ,new String[]{String.valueOf(id)});
		c.moveToFirst();
		int id_note = c.getInt(0);
		String titre = c.getString(1);
		String descrition = c.getString(2);
		int importance = c.getInt(3);
        String dateCreation = c.getString(4);
        String dateAlarme = c.getString(5);
		Note n = new Note(id_note,titre,descrition,importance,dateCreation,dateAlarme);
		return n;
	}
	/**
         *  renvoie un list de toute les notes de la base de donnée
         */
	public List<Note> getAll()
	{
        List<Note> notes = new ArrayList<Note>();
 
		Cursor cursor = database.query(DatabaseHandler.NOTE_TABLE_NAME,
				allColumns,null,null,null,null,null);
		while(cursor.moveToNext())
		{
			Note note = new Note(cursor.getInt(0),cursor.getString(1),cursor.getString(2),cursor.getInt(3),cursor.getString(4),cursor.getString(5));
			notes.add(note);
		}
		// fermer le cursor
		cursor.close();
 
		return notes;
	}
 
	/**
         * remettre la table à 0
         */
	public void reset()
	{
		database.execSQL(dbHandler.NOTE_TABLE_DROP);
		dbHandler.onCreate(database);
	}
}
Merci d'avance pour votre aide , je bloque complètement .

Edit: Problème résolu il manquait simplement un espace avant le "text not null" ...