Get First Row Data If Exist In SQLite
I am writing an app in which i need to fetch first row data if exist in SQLite database table, I have written code to store data into database, but now i want to fetch first row da
Solution 1:
do this
Cursor cursor = db.query(TABLE_NAME, new String[] { "*" },
null,
null, null, null, null, null);
if(cursor != null)
{
if (cursor.moveToFirst()) {
arrData = new String[cursor.getColumnCount()];
arrData[0] = cursor.getString(0); // DeviceID
arrData[1] = cursor.getString(1); // EmailID
arrData[2] = cursor.getString(2); // Event
arrData[3] = cursor.getString(3); // Operator
arrData[4] = cursor.getString(4); // EventOperator
}
cursor.close();
}
db.close();
return arrData;
Post a Comment for "Get First Row Data If Exist In SQLite"