Is this syntax is correct to get Particular column from Table? Table name- FI_GOODS_DETAIL_TABLE, Column name- FIGOODSDETAIL_FINISHGOODS...
"select " + FIGOODSDETAIL_FINISHGOODS + "from " + FI_GOODS_DETAIL_TABLE + ";";
And am storing column values in arrray
public List<String> getAllLabels(){
List<String> labels = new ArrayList<String>();
// Select All Query
String selectQuery = "select " + FIGOODSDETAIL_FINISHGOODS + "from " + FI_GOODS_DETAIL_TABLE + ";";
try {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
} catch (Exception exe) {
exe.printStackTrace();
db.endTransaction();
Log.e("Insertion failed",
"Transaction failure when inserting login data.");
this.closeDatabase();
Log.i("DB closed", "Database closed successfully.");
errCode = "Err-DB-06";
LogFileCreator.appendLog(errCode + " : " + exe.getMessage());
}
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
labels.add(cursor.getString(1));
} while (cursor.moveToNext());
}
// closing connection
cursor.close();
db.close();
// returning lables
return labels;
}
Aucun commentaire:
Enregistrer un commentaire