|
|
|
Android ขอสอบถามเรื่องการ Search ข้อมูลจาก SQLite หน่อยครับ |
|
|
|
|
|
|
|
Code (Android-Java)
// Search Data
public String[] SerchData(String strName) {
// TODO Auto-generated method stub
try {
String arrData[] = null;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
Cursor cursor = db.query(TABLE_MEMBER, new String[] { "*" },
"Name LIKE '%?%' ",
new String[] { String.valueOf(strName) }, null, null, null, null);
if(cursor != null)
{
if (cursor.moveToFirst()) {
arrData = new String[cursor.getColumnCount()];
/***
* 0 = MemberID
* 1 = Name
* 2 = Tel
*/
arrData[0] = cursor.getString(0);
arrData[1] = cursor.getString(1);
arrData[2] = cursor.getString(2);
}
}
cursor.close();
db.close();
return arrData;
} catch (Exception e) {
return null;
}
}
Android Read Show Data from SQLite Database (Android SQLite)
|
|
|
|
|
Date :
2015-02-20 08:06:04 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ
|
|
|
|
|
Date :
2015-02-20 16:03:08 |
By :
KIKEE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|