dimanche 28 juin 2015

no such column exception sqlite

im doing an application using an sqlite database and im having an exception in this

  public Prof getProffromcompte(int login){
    Cursor c = bdd.query(TABLE_PROF, new String[] {COL_ID_PROF, COL_NOM_PROF, COL_LOGIN_PROF}, COL_LOGIN_PROF + " LIKE \"" + login +"\"", null, null, null, null);
    return cursorToProf(c);
}

and this is th log :

Process: com.example.radouane.myapplication, PID: 14289
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.radouane.myapplication/com.example.radouane.myapplication.activ2}: android.database.sqlite.SQLiteException: no such column: nom_prof (code 1): , while compiling: SELECT ID_prof, nom_prof, login_prof FROM table_prof WHERE login_prof LIKE "2"
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2331)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
        at android.app.ActivityThread.access$800(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5349)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
 Caused by: android.database.sqlite.SQLiteException: no such column: nom_prof (code 1): , while compiling: SELECT ID_prof, nom_prof, login_prof FROM table_prof WHERE login_prof LIKE "2"
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:897)
        at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:508)
        at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:726)
        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:1426)
        at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1273)
        at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1144)
        at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1312)
        at com.example.radouane.myapplication.BDD.getProffromcompte(BDD.java:195)
        at com.example.radouane.myapplication.activ2.chooseModule(activ2.java:76)
        at com.example.radouane.myapplication.activ2.onCreate(activ2.java:49)
        at android.app.Activity.performCreate(Activity.java:6020)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2284)

            

i verified that when creating the table i have the same same column name : nom_prof

Aucun commentaire:

Enregistrer un commentaire