vendredi 30 octobre 2015

Syntax error in SQL android

  db.execSQL("create table " + TABLE_WORKDETAILS + "( " + ID2 + " INTEGER PRIMARY KEY , Project TEXT, WorkDescription TEXT, Per Text, TimeIn DATETIME, TimeOut DATETIME, Twf_id INTEGER, FOREIGN KEY(Twf_id) REFERENCES "+TABLE_WORKFORCE+ "(ID))");
  db.execSQL("create table " + TABLE_STAFF_BENEFICT + "( "  + ID3 + " INTEGER PRIMARY KEY , Description TEXT , Amount TEXT, Twd_id INTEGER, FOREIGN KEY(Twd_id) REFERENCES + "+ TABLE_WORKDETAILS+ "(Twf_id))");

LogCat Error

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.project.project/com.example.project.project.CameraMain}: android.database.sqlite.SQLiteException: near "+": syntax error (code 1): , while compiling: create table StaffBenefict( _id INTEGER PRIMARY KEY , Description TEXT , Amount TEXT, Twd_id INTEGER, FOREIGN KEY(Twd_id) REFERENCES + WorkDetails(Twf_id)) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2413)

Aucun commentaire:

Enregistrer un commentaire