My table was created using
db.execSQL( "CREATE TABLE periods (" + " vehicle_id INTEGER KEY," + " line_id INTEGER KEY," + " period_id INTEGER PRIMARY KEY AUTOINCREMENT," + " line_code STRING," + " sup_code STRING," + " start_date INTEGER," + " end_date INTEGER" + ")" );
And the data was inserted using
ContentValues values = new ContentValues(); values.put("vehicle_id", 1); values.put("line_id", 2); values.put("line_code", "0406"); values.put("sup_code", " "); values.put("start_date", 1); values.put("end_date", 24); db.insert("periods", null, values);
But when I get data from
Cursor cPeriods = db.rawQuery("SELECT * FROM periods WHERE vehicle_id=" + vehicleId, null); System.err.printf("SQLite:
The result will always be "406"
How to solve this problem? I donβt want to make an ugly correction, for example, put the character β0406β before the insertion and delete it after extraction.
source share