1
我創建一個樣本庫的應用程序,我想儲存庫項目在本地SQLite數據庫如何編寫方法爲Android SQLite數據庫
樣品查詢:
select filed1 from tablename where filed2="66547";
public List<String> getAllLabels(String number){
List<String> labels = new ArrayList<String>();
String foldername;
// Select All Query
String selectQuery = " SELECT " + Databaseconnect.FILEPATH + " FROM "+ Databaseconnect.TABLE_FILE + " WHERE" + Databaseconnect.FOLDERLINK="+"number;
SQLiteDatabase db = dbHelper.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
labels.add(cursor.getString(0));
} while (cursor.moveToNext());
}
// closing connection
cursor.close();
db.close();
// returning lables
return labels;
}
我仍然有錯誤,怎麼寫列表在此查詢..請給我的解決方案
請一些個s解決我的問題... –