public static final String KEY_ROWID = "_id"; public static final String KEY_PRENOM = "prenom";// Prénom du joueur public static final String KEY_NOM = "nom"; // Nom du joueur
public static final String KEY_EQUIPE_ID = "equipe"; // ID de l'équpie //utlisé dans joueur.xml //info personnelles public static final String KEY_MAILLOT = "maillot"; // numéro de maillot joueur public static final String KEY_BIRTH = "naissance"; // date de naissance joueur //public static final String KEY_PHOTO = "photo"; // photo du joueur à implémenter dans le futur //Stats dans le match public static final String KEY_DECISIV = "decisiv"; // nombre de passes decisives à l'année public static final String KEY_REBONDS = "rebonds"; // nombre de rebonds à l'annee public static final String KEY_MATCH = "match"; // nombre de matchs joués public static final String KEY_INTERCEPT = "intercept"; // nombre d'interceptions public static final String KEY_CONTRES = "contres"; // nombre de contre effectués public static final String KEY_PERTEBALLE = "perte"; // nombre de balles perdues public static final String KEY_FAUTES = "fautes"; //nombre de fautes commises public static final String KEY_ESSAI2 = "essai2"; // nombre d'essai à 2pts public static final String KEY_ESSAI3 = "essai3"; // nombre d'essai à 3pts public static final String KEY_ESSAILF = "essailf"; //nombre d'essai de lancés francs public static final String KEY_2PTS = "deuxpts"; // nombre de 2pts réussis public static final String KEY_3PTS = "troispts"; // nombre de 3pts réussis public static final String KEY_LF = "lf"; // nombre de lancés francs //fin
private static final String TAG = "bdd"; private DatabaseHelper mDbHelper; private SQLiteDatabase mDb;
private static final String DATABASE_NAME = "Basket"; private static final String SQLITE_TABLE = "Joueur"; private static final int DATABASE_VERSION = 1;
@Override public void onCreate(SQLiteDatabase db) { Log.w(TAG, DATABASE_CREATE); db.execSQL(DATABASE_CREATE); }
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS " + SQLITE_TABLE); onCreate(db); } }
public bdd(Context ctx) { this.mCtx = ctx; }
public bdd open() throws SQLException { mDbHelper = new DatabaseHelper(mCtx); mDb = mDbHelper.getWritableDatabase(); return this; }
public void close() { if (mDbHelper != null) { mDbHelper.close(); } }
04-25 10:15:12.217 13256-13256/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.simon.applicationbasket, PID: 13256 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.simon.applicationbasket/com.example.simon.applicationbasket.MainActivity}: android.database.sqlite.SQLiteException: no such column: prenom (code 1): , while compiling: SELECT _id, prenom, nom, equipe, naissance, maillot, decisiv, rebonds, match, intercept, contres, perte, fautes, essai2, essai3, essailf, deuxpts, troispts, lf FROM Joueur at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286) at android.app.ActivityThread.access$800(ActivityThread.java:145) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5127) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641) at dalvik.system.NativeStart.main(Native Method) Caused by: android.database.sqlite.SQLiteException: no such column: prenom (code 1): , while compiling: SELECT _id, prenom, nom, equipe, naissance, maillot, decisiv, rebonds, match, intercept, contres, perte, fautes, essai2, essai3, essailf, deuxpts, troispts, lf FROM Joueur at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58) at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37) at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44) at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314) at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1161) at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1032) at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1200) at com.example.simon.applicationbasket.bdd.fetchAllJoueurs(bdd.java:201) at com.example.simon.applicationbasket.MainActivity.displayListView(MainActivity.java:42) at com.example.simon.applicationbasket.MainActivity.onCreate(MainActivity.java:36) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286) at android.app.ActivityThread.access$800(ActivityThread.java:145) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5127) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641) at dalvik.system.NativeStart.main(Native Method) 04-25 10:15:12.227 13256-13256/? I/Process: Sending signal. PID: 13256 SIG: 9
J'ai tout cherché je trouve pas, on doit rendre notre projet tut dans 1 mois